#[repr(transparent)]pub struct Value(pub VALUE);Expand description
Wraps a plain old Ruby FFI VALUE with much more functionality.
Tuple Fields§
§0: VALUEImplementations§
Source§impl 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§
impl Copy for Value
impl Eq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more