Struct ruru::Symbol
[−]
[src]
pub struct Symbol { // some fields omitted }
Symbol
Methods
impl Symbol
[src]
fn new(string: &str) -> Self
Creates a new instance of Ruby Symbol
.
Examples
use ruru::{Symbol, VM}; let symbol = Symbol::new("hello"); assert_eq!(symbol.to_string(), "hello");
Ruby:
sym = :hello
sym.to_s == 'hello'
fn to_string(&self) -> String
Retrieves the Rust String
corresponding to Symbol
object (Ruby Symbol#to_s
).
Examples
use ruru::{Symbol, VM}; let symbol = Symbol::new("hello"); assert_eq!(symbol.to_string(), "hello");
Ruby:
sym = :hello
sym.to_s == 'hello'
Trait Implementations
impl PartialEq for Symbol
[src]
fn eq(&self, __arg_0: &Symbol) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Symbol) -> bool
This method tests for !=
.
impl Debug for Symbol
[src]
impl From<Value> for Symbol
[src]
impl Object for Symbol
[src]
fn value(&self) -> Value
Usually this function just returns a value
of current object. Read more
fn class(&self) -> Class
Returns a Class
struct of current object Read more
fn send(&self, method: &str, arguments: Vec<AnyObject>) -> AnyObject
Calls a given method on an object similarly to Ruby Object#send
method Read more
fn is_nil(&self) -> bool
Checks weather the object is nil
Read more
fn to_any_object(&self) -> AnyObject
Converts struct to AnyObject
Read more
fn instance_variable_get(&self, variable: &str) -> AnyObject
Sets an instance variable for object Read more
fn instance_variable_set<T: Object>(&mut self, variable: &str, value: T) -> AnyObject
Gets an instance variable of object Read more