[−][src]Struct rosy::Symbol
An instance of Ruby's Symbol class.
Methods
impl Symbol[src]
pub fn is_valid(name: impl AsRef<[u8]>) -> bool[src]
Returns whether name is valid as a symbol value.
Examples
use rosy::Symbol; assert!(Symbol::is_valid("@hello")); assert!(!Symbol::is_valid("\0a")); assert!(!Symbol::is_valid("$")); assert!(!Symbol::is_valid("@")); assert!(!Symbol::is_valid(""));
pub fn id(self) -> SymbolId[src]
Returns the identifier associated with this symbol.
pub fn name(self) -> &'static CStr[src]
Returns the symbol's name as a nul-terminated C string.
Trait Implementations
impl GcInfoKey for Symbol[src]
fn stat_gc(self) -> Result<usize>[src]
unsafe fn stat_gc_unchecked(self) -> usize[src]
fn latest_gc_info(self) -> Result<AnyObject>[src]
unsafe fn latest_gc_info_unchecked(self) -> AnyObject[src]
impl Classify for Symbol[src]
impl Object for Symbol[src]
fn cast<A: Object>(obj: A) -> Option<Self>[src]
fn ty(self) -> Ty[src]
fn is_ty(self, ty: Ty) -> bool[src]
fn unique_id() -> Option<u128>[src]
Returns a unique identifier for an object type to facilitate casting. Read more
unsafe fn from_raw(raw: usize) -> Self[src]
Creates a new object from raw without checking. Read more
unsafe fn cast_unchecked(obj: impl Object) -> Self[src]
Casts obj to Self without checking its type.
fn into_any_object(self) -> AnyObject[src]
Returns self as an AnyObject.
fn as_any_object(&self) -> &AnyObject[src]
Returns a reference to self as an AnyObject.
fn as_any_slice(&self) -> &[AnyObject][src]
Returns self as a reference to a single-element slice.
fn raw(self) -> usize[src]
Returns the raw object pointer.
unsafe fn as_unchecked<O: Object>(&self) -> &O[src]
Casts self to O without checking whether it is one.
unsafe fn into_unchecked<O: Object>(self) -> O[src]
Converts self to O without checking whether it is one.
fn id(self) -> u64[src]
Returns the object's identifier.
fn class(self) -> Class<Self>[src]
Returns the Class for self. Read more
fn singleton_class(self) -> Class<Self>[src]
Returns the singleton Class of self, creating one if it doesn't exist already. Read more
fn mark(self)[src]
Marks self for Ruby to avoid garbage collecting it.
unsafe fn force_recycle(self)[src]
Forces the garbage collector to free the contents of self. Read more
fn def_singleton_method<N, F>(self, name: N, f: F) -> Result where
N: Into<SymbolId>,
F: MethodFn<Self>, [src]
N: Into<SymbolId>,
F: MethodFn<Self>,
Defines a method for name on the singleton class of self that calls f when invoked. Read more
unsafe fn def_singleton_method_unchecked<N, F>(self, name: N, f: F) where
N: Into<SymbolId>,
F: MethodFn<Self>, [src]
N: Into<SymbolId>,
F: MethodFn<Self>,
Defines a method for name on the singleton class of self that calls f when invoked. Read more
fn call(self, method: impl Into<SymbolId>) -> Result<AnyObject>[src]
Calls method on self and returns the result.
unsafe fn call_unchecked(self, method: impl Into<SymbolId>) -> AnyObject[src]
Calls method on self and returns the result. Read more
fn call_with(
self,
method: impl Into<SymbolId>,
args: &[impl Object]
) -> Result<AnyObject>[src]
self,
method: impl Into<SymbolId>,
args: &[impl Object]
) -> Result<AnyObject>
Calls method on self with args and returns the result.
unsafe fn call_with_unchecked(
self,
method: impl Into<SymbolId>,
args: &[impl Object]
) -> AnyObject[src]
self,
method: impl Into<SymbolId>,
args: &[impl Object]
) -> AnyObject
Calls method on self with args and returns the result. Read more
fn call_public(self, method: impl Into<SymbolId>) -> Result<AnyObject>[src]
Calls the public method on self and returns the result.
unsafe fn call_public_unchecked(self, method: impl Into<SymbolId>) -> AnyObject[src]
Calls the public method on self and returns the result. Read more
fn call_public_with(
self,
method: impl Into<SymbolId>,
args: &[impl Object]
) -> Result<AnyObject>[src]
self,
method: impl Into<SymbolId>,
args: &[impl Object]
) -> Result<AnyObject>
Calls the public method on self with args and returns the result.
unsafe fn call_public_with_unchecked(
self,
method: impl Into<SymbolId>,
args: &[impl Object]
) -> AnyObject[src]
self,
method: impl Into<SymbolId>,
args: &[impl Object]
) -> AnyObject
Calls the public method on self with args and returns the result. Read more
fn inspect(self) -> String[src]
Returns a printable string representation of self. Read more
fn to_s(self) -> String[src]
Returns the result of calling the to_s method on self.
fn is_frozen(self) -> bool[src]
Returns whether modifications can be made to self.
fn freeze(self)[src]
Freezes self, preventing any further mutations.
fn is_eql<O: Object>(self, other: &O) -> bool[src]
Returns whether self is equal to other in terms of the eql? method. Read more
impl Copy for Symbol[src]
impl AsRef<AnyObject> for Symbol[src]
impl Clone for Symbol[src]
fn clone(&self) -> Symbol[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl PartialEq<AnyObject> for Symbol[src]
fn eq(&self, obj: &AnyObject) -> bool[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.
impl From<Symbol> for AnyObject[src]
impl From<String> for Symbol[src]
impl<'_> From<&'_ str> for Symbol[src]
impl From<Symbol> for SymbolId[src]
impl From<SymbolId> for Symbol[src]
impl Display for Symbol[src]
impl Debug for Symbol[src]
impl<'_> TryFrom<Symbol> for &'_ str[src]
type Error = Utf8Error
The type returned in the event of a conversion error.
fn try_from(s: Symbol) -> Result<Self, Self::Error>[src]
impl TryFrom<Symbol> for String[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,