Update is_empty docs.
This commit is contained in:
parent
b75ea94908
commit
855ddd28a6
@ -216,7 +216,7 @@ impl IntoIterator for RangeCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RangeCase {
|
impl RangeCase {
|
||||||
/// Is the range empty?
|
/// Returns `true` if the range contains no items.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
@ -356,7 +356,7 @@ impl StmtBlock {
|
|||||||
span: Span::new(pos, pos),
|
span: Span::new(pos, pos),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Is this statements block empty?
|
/// Returns `true` if this statements block contains no statements.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
|
@ -591,7 +591,7 @@ impl Module {
|
|||||||
self.custom_types.get(key)
|
self.custom_types.get(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is the [`Module`] empty?
|
/// Returns `true` if this [`Module`] contains no items.
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
|
@ -86,7 +86,7 @@ impl ModuleResolversCollection {
|
|||||||
self.0.clear();
|
self.0.clear();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
/// Is this [`ModuleResolversCollection`] empty?
|
/// Returns `true` if this [`ModuleResolversCollection`] contains no module resolvers.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
|
@ -98,7 +98,7 @@ impl StaticModuleResolver {
|
|||||||
self.0.clear();
|
self.0.clear();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
/// Is this [`StaticModuleResolver`] empty?
|
/// Returns `true` if this [`StaticModuleResolver`] contains no module resolvers.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
|
@ -63,23 +63,21 @@ impl StringsInterner<'_> {
|
|||||||
/// Get an identifier from a text string, adding it to the interner if necessary.
|
/// Get an identifier from a text string, adding it to the interner if necessary.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn get<T: AsRef<str> + Into<ImmutableString>>(&mut self, text: T) -> ImmutableString {
|
pub fn get<S: AsRef<str> + Into<ImmutableString>>(&mut self, text: S) -> ImmutableString {
|
||||||
self.get_with_mapper(|s| s.into(), text)
|
self.get_with_mapper(|s| s.into(), text)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get an identifier from a text string, adding it to the interner if necessary.
|
/// Get an identifier from a text string, adding it to the interner if necessary.
|
||||||
#[inline]
|
#[inline]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn get_with_mapper<T: AsRef<str> + Into<ImmutableString>>(
|
pub fn get_with_mapper<S: AsRef<str>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
mapper: fn(T) -> ImmutableString,
|
mapper: fn(S) -> ImmutableString,
|
||||||
text: T,
|
text: S,
|
||||||
) -> ImmutableString {
|
) -> ImmutableString {
|
||||||
let key = text.as_ref();
|
let key = text.as_ref();
|
||||||
|
|
||||||
// Do not intern long strings or numbers
|
if key.len() > MAX_STRING_LEN {
|
||||||
if key.len() > MAX_STRING_LEN || key.bytes().all(|c| c == b'.' || (c >= b'0' && c <= b'9'))
|
|
||||||
{
|
|
||||||
return mapper(text);
|
return mapper(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +131,7 @@ impl StringsInterner<'_> {
|
|||||||
self.strings.len()
|
self.strings.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Are there no interned strings?
|
/// Returns `true` if there are no interned strings.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
|
@ -214,7 +214,7 @@ impl Scope<'_> {
|
|||||||
pub fn len(&self) -> usize {
|
pub fn len(&self) -> usize {
|
||||||
self.values.len()
|
self.values.len()
|
||||||
}
|
}
|
||||||
/// Is the [`Scope`] empty?
|
/// Returns `true` if this [`Scope`] contains no variables.
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user