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