pub struct Object { /* private fields */ }
Expand description
Wrapper for anything type
Implementations§
Source§impl Object
impl Object
pub fn new<T>(val: *mut T) -> Self
Sourcepub fn get<T: Clone>(&self) -> T
pub fn get<T: Clone>(&self) -> T
§Returns the cloned value from struct
If (T != type of value in struct) => ??? Example:
let int_object = object_type::obj!(6982_i32);
let _ = int_object.get::<i32>(); // Ok
// let _ = int_object.get::<i64>(); => ???
Sourcepub fn get_ptr<T>(&self) -> *mut T
pub fn get_ptr<T>(&self) -> *mut T
§Returns the value pointer casted to <T> type
If (T != type of value in struct) => ??? Example:
let int_object = object_type::obj!(6982_i32);
let _ = int_object.get_ptr::<i32>(); // Ok
// let _ = int_object.get_ptr::<i64>(); => ???
Sourcepub fn __value_to_string<T: ToString>(&self) -> String
pub fn __value_to_string<T: ToString>(&self) -> String
Unstable?
Example:
let int_object = object_type::obj!(2372_i16);
println!("=> {}", int_object.__value_to_string::<i16>());
pub fn equals<T>(&self, other: T) -> bool
Trait Implementations§
Source§impl PartialOrd for Object
impl PartialOrd for Object
impl Copy for Object
impl StructuralPartialEq for Object
Auto Trait Implementations§
impl Freeze for Object
impl RefUnwindSafe for Object
impl !Send for Object
impl !Sync for Object
impl Unpin for Object
impl UnwindSafe for Object
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