Struct rutie::Symbol[][src]

pub struct Symbol { /* fields omitted */ }

Symbol

Implementations

impl Symbol[src]

pub fn new(string: &str) -> Self[src]

Creates a new instance of Ruby Symbol.

Examples

use rutie::{Symbol, VM};

let symbol = Symbol::new("hello");

assert_eq!(symbol.to_str(), "hello");

Ruby:

sym = :hello

sym.to_s == 'hello'

pub fn to_str(&self) -> &str[src]

Retrieves the Rust &str corresponding to Symbol object (Ruby Symbol#to_s).

Examples

use rutie::{Symbol, VM};

let symbol = Symbol::new("hello");

assert_eq!(symbol.to_str(), "hello");

Ruby:

sym = :hello

sym.to_s == 'hello'

pub fn to_string(&self) -> String[src]

Retrieves the Rust String corresponding to Symbol object (Ruby Symbol#to_s).

Examples

use rutie::{Symbol, VM};

let symbol = Symbol::new("hello");

assert_eq!(symbol.to_string(), "hello");

Ruby:

sym = :hello

sym.to_s == 'hello'

pub fn to_proc(&self) -> Proc[src]

Converts Symbol to Proc

Examples

use rutie::{Symbol, Proc, VM, VerifiedObject};

let symbol = Symbol::new("hello");

assert!(Proc::is_correct_type(&symbol.to_proc()), "not correct type!");

Ruby:

sym = :hello

sym.to_s == 'hello'

Trait Implementations

impl Debug for Symbol[src]

impl From<Value> for Symbol[src]

impl Into<AnyObject> for Symbol[src]

impl Into<Value> for Symbol[src]

impl Object for Symbol[src]

impl PartialEq<Symbol> for Symbol[src]

impl VerifiedObject for Symbol[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.