#[repr(transparent)]pub struct Value(pub VALUE);
Expand description
Wraps a plain old Ruby FFI VALUE
with much more functionality.
Tuple Fields
0: VALUE
Implementations
sourceimpl Value
impl Value
sourcepub fn send(
&self,
method_name: &str,
arguments: &[Value]
) -> Result<Value, CaughtException>
pub fn send(
&self,
method_name: &str,
arguments: &[Value]
) -> Result<Value, CaughtException>
Sends a Ruby method and returns the result.
sourcepub unsafe fn send_unprotected(
&self,
method_name: &str,
arguments: &[Value]
) -> Value
pub unsafe fn send_unprotected(
&self,
method_name: &str,
arguments: &[Value]
) -> Value
Sends a Ruby method without rescuing Ruby unwind.
sourcepub fn constant(&self, constant_name: &str) -> Result<Value, CaughtException>
pub fn constant(&self, constant_name: &str) -> Result<Value, CaughtException>
Gets a constant by name. Equivalent to Object#const_get(constant_name)
.
sourcepub unsafe fn constant_unprotected(&self, constant_name: &str) -> Value
pub unsafe fn constant_unprotected(&self, constant_name: &str) -> Value
Gets a constant by name. Equivalent to Object#const_get(constant_name)
.
sourcepub fn set_constant(
&self,
constant_name: &str,
value: Value
) -> Result<(), CaughtException>
pub fn set_constant(
&self,
constant_name: &str,
value: Value
) -> Result<(), CaughtException>
Sets a constant. Equivalent to Object#const_set(constant_name, value)
.
sourcepub unsafe fn set_constant_unprotected(&self, constant_name: &str, value: Value)
pub unsafe fn set_constant_unprotected(&self, constant_name: &str, value: Value)
Sets a constant. Equivalent to Object#const_set(constant_name, value)
.
sourcepub fn to_s(&self) -> Result<String, CaughtException>
pub fn to_s(&self) -> Result<String, CaughtException>
Convert a Ruby value to a Rust string.
Calls Object#to_s
and then converts the result to a string.
sourcepub unsafe fn to_s_unprotected(&self) -> String
pub unsafe fn to_s_unprotected(&self) -> String
Convert a Ruby value to a Rust string.
sourcepub fn object_class_name(&self) -> String
pub fn object_class_name(&self) -> String
Convert a Ruby string to a Rust string. Gets the class name for an object
sourcepub fn inspect(&self) -> Result<Value, CaughtException>
pub fn inspect(&self) -> Result<Value, CaughtException>
Calls Object#inspect
sourcepub unsafe fn inspect_unprotected(&self) -> Value
pub unsafe fn inspect_unprotected(&self) -> Value
Calls Object#inspect
sourcepub fn is_of_value_type(&self, value_type: value_type) -> bool
pub fn is_of_value_type(&self, value_type: value_type) -> bool
Checks if this object is of the given value type.
pub fn convert_array(values: &[Value]) -> &[VALUE]
Trait Implementations
sourceimpl FromStr for Value
impl FromStr for Value
type Err = CaughtException
type Err = CaughtException
The associated error which can be returned from parsing.
impl Copy for Value
impl Eq for Value
impl StructuralEq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more