[−][src]Struct artichoke_backend::extn::core::symbol::Symbol
Identifier bound to an interned bytestring.
A Symbol
allows retrieving a reference to the original interned
bytestring. Equivalent Symbol
s will resolve to an identical bytestring.
Symbol
s are based on a u32
index. They are cheap to compare and cheap to
copy.
Symbol
s are not constrained to the interner which created them.
Implementations
impl Symbol
[src]
#[must_use]pub const fn new(id: u32) -> Symbol
[src]
Construct a new Symbol
from the given u32
.
Symbol
s constructed manually may fail to resolve to an underlying
bytesstring.
Symbol
s are not constrained to the interner which created them.
No runtime checks ensure that the underlying interner is called with a
Symbol
that the interner itself issued.
Examples
let sym = Symbol::new(263); assert_eq!(sym.id(), 263);
#[must_use]pub const fn id(self) -> u32
[src]
Return the u32
identifier from this Symbol
.
Examples
let sym = Symbol::new(263); assert_eq!(sym.id(), 263); assert_eq!(u32::from(sym), 263);
#[must_use]pub fn is_empty<T, U>(self, interner: &T) -> bool where
T: Intern<Symbol = U>,
U: Copy + From<Symbol>,
[src]
T: Intern<Symbol = U>,
U: Copy + From<Symbol>,
Returns whether the symbol is the empty byteslice b""
in the
underlying interner.
If there symbol does not exist in the underlying interner or there is an
error looking up the symbol in the underlying interner, true
is
returned.
#[must_use]pub fn len<T, U>(self, interner: &T) -> usize where
T: Intern<Symbol = U>,
U: Copy + From<Symbol>,
[src]
T: Intern<Symbol = U>,
U: Copy + From<Symbol>,
Returns the length of the byteslice associated with the symbol in the underlying interner.
If there symbol does not exist in the underlying interner or there is an
error looking up the symbol in the underlying interner, 0
is returned.
#[must_use]pub fn bytes<T, U>(self, interner: &T) -> &[u8] where
T: Intern<Symbol = U>,
U: Copy + From<Symbol>,
[src]
T: Intern<Symbol = U>,
U: Copy + From<Symbol>,
Returns the interned byteslice associated with the symbol in the underlying interner.
If there symbol does not exist in the underlying interner or there is an
error looking up the symbol in the underlying interner, &[]
is
returned.
pub fn inspect<T, U>(self, interner: &T) -> Inspect<'_> where
T: Intern<Symbol = U>,
U: Copy + From<Symbol>,
[src]
T: Intern<Symbol = U>,
U: Copy + From<Symbol>,
Returns an iterator that yields a debug representation of the interned byteslice associated with the symbol in the underlying interner.
This iterator produces char
sequences like :spinoso
and
:"invalid-\xFF-utf8"
.
If there symbol does not exist in the underlying interner or there is an error looking up the symbol in the underlying interner, a default iterator is returned.
Trait Implementations
impl Borrow<u32> for Symbol
[src]
impl BoxUnboxVmValue for Symbol
[src]
type Unboxed = Self
type Guarded = Immediate<Self::Unboxed>
const RUBY_TYPE: &'static str
[src]
unsafe fn unbox_from_value<'a>(
value: &'a mut Value,
interp: &mut Artichoke
) -> Result<UnboxedValueGuard<'a, Self::Guarded>, Error>
[src]
value: &'a mut Value,
interp: &mut Artichoke
) -> Result<UnboxedValueGuard<'a, Self::Guarded>, Error>
fn alloc_value(
value: Self::Unboxed,
interp: &mut Artichoke
) -> Result<Value, Error>
[src]
value: Self::Unboxed,
interp: &mut Artichoke
) -> Result<Value, Error>
fn box_into_value(
value: Self::Unboxed,
into: Value,
interp: &mut Artichoke
) -> Result<Value, Error>
[src]
value: Self::Unboxed,
into: Value,
interp: &mut Artichoke
) -> Result<Value, Error>
fn free(data: *mut c_void)
[src]
impl Clone for Symbol
[src]
impl Copy for Symbol
[src]
impl Debug for Symbol
[src]
impl Eq for Symbol
[src]
impl<'_> From<&'_ NonZeroU16> for Symbol
[src]
pub fn from(sym: &NonZeroU16) -> Symbol
[src]
impl<'_> From<&'_ NonZeroU32> for Symbol
[src]
pub fn from(sym: &NonZeroU32) -> Symbol
[src]
impl<'_> From<&'_ NonZeroU8> for Symbol
[src]
impl<'_> From<&'_ u16> for Symbol
[src]
impl<'_> From<&'_ u32> for Symbol
[src]
impl<'_> From<&'_ u8> for Symbol
[src]
impl From<NonZeroU16> for Symbol
[src]
pub fn from(sym: NonZeroU16) -> Symbol
[src]
impl From<NonZeroU32> for Symbol
[src]
pub fn from(sym: NonZeroU32) -> Symbol
[src]
impl From<NonZeroU8> for Symbol
[src]
impl From<u16> for Symbol
[src]
impl From<u32> for Symbol
[src]
impl From<u8> for Symbol
[src]
impl Hash for Symbol
[src]
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Symbol
[src]
pub fn cmp(&self, other: &Symbol) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<'_> PartialEq<&'_ u32> for Symbol
[src]
pub fn eq(&self, other: &&u32) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<Symbol> for Symbol
[src]
impl<'_> PartialEq<u32> for &'_ Symbol
[src]
pub fn eq(&self, other: &u32) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<u32> for Symbol
[src]
pub fn eq(&self, other: &u32) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<Symbol> for Symbol
[src]
pub fn partial_cmp(&self, other: &Symbol) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Symbol) -> bool
[src]
pub fn le(&self, other: &Symbol) -> bool
[src]
pub fn gt(&self, other: &Symbol) -> bool
[src]
pub fn ge(&self, other: &Symbol) -> bool
[src]
impl StructuralEq for Symbol
[src]
impl StructuralPartialEq for Symbol
[src]
impl<'_> TryFrom<&'_ NonZeroU64> for Symbol
[src]
type Error = SymbolOverflowError
The type returned in the event of a conversion error.
pub fn try_from(
value: &NonZeroU64
) -> Result<Symbol, <Symbol as TryFrom<&'_ NonZeroU64>>::Error>
[src]
value: &NonZeroU64
) -> Result<Symbol, <Symbol as TryFrom<&'_ NonZeroU64>>::Error>
impl<'_> TryFrom<&'_ NonZeroUsize> for Symbol
[src]
type Error = SymbolOverflowError
The type returned in the event of a conversion error.
pub fn try_from(
value: &NonZeroUsize
) -> Result<Symbol, <Symbol as TryFrom<&'_ NonZeroUsize>>::Error>
[src]
value: &NonZeroUsize
) -> Result<Symbol, <Symbol as TryFrom<&'_ NonZeroUsize>>::Error>
impl<'_> TryFrom<&'_ u64> for Symbol
[src]
type Error = SymbolOverflowError
The type returned in the event of a conversion error.
pub fn try_from(
value: &u64
) -> Result<Symbol, <Symbol as TryFrom<&'_ u64>>::Error>
[src]
value: &u64
) -> Result<Symbol, <Symbol as TryFrom<&'_ u64>>::Error>
impl<'_> TryFrom<&'_ usize> for Symbol
[src]
type Error = SymbolOverflowError
The type returned in the event of a conversion error.
pub fn try_from(
value: &usize
) -> Result<Symbol, <Symbol as TryFrom<&'_ usize>>::Error>
[src]
value: &usize
) -> Result<Symbol, <Symbol as TryFrom<&'_ usize>>::Error>
impl TryFrom<NonZeroU64> for Symbol
[src]
type Error = SymbolOverflowError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroU64
) -> Result<Symbol, <Symbol as TryFrom<NonZeroU64>>::Error>
[src]
value: NonZeroU64
) -> Result<Symbol, <Symbol as TryFrom<NonZeroU64>>::Error>
impl TryFrom<NonZeroUsize> for Symbol
[src]
type Error = SymbolOverflowError
The type returned in the event of a conversion error.
pub fn try_from(
value: NonZeroUsize
) -> Result<Symbol, <Symbol as TryFrom<NonZeroUsize>>::Error>
[src]
value: NonZeroUsize
) -> Result<Symbol, <Symbol as TryFrom<NonZeroUsize>>::Error>
impl TryFrom<u64> for Symbol
[src]
type Error = SymbolOverflowError
The type returned in the event of a conversion error.
pub fn try_from(value: u64) -> Result<Symbol, <Symbol as TryFrom<u64>>::Error>
[src]
impl TryFrom<usize> for Symbol
[src]
Auto Trait Implementations
impl RefUnwindSafe for Symbol
[src]
impl Send for Symbol
[src]
impl Sync for Symbol
[src]
impl Unpin for Symbol
[src]
impl UnwindSafe for Symbol
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,