pub struct PointerUsize(/* private fields */);
Expand description
Pointer
implementation for usize
.
Implementations§
Source§impl PointerUsize
impl PointerUsize
Sourcepub fn new(value: usize) -> Option<Self>
pub fn new(value: usize) -> Option<Self>
Safe constructor for the pointer.
Returns None
if the value provided is out of bounds for the pointer type.
§Examples
use syntree::pointer::Pointer;
use syntree::pointer::PointerUsize;
let v = PointerUsize::new(0).ok_or("out of bounds")?;
assert_eq!(v.get(), 0);
let v = PointerUsize::new(42).ok_or("out of bounds")?;
assert_eq!(v.get(), 42);
Trait Implementations§
Source§impl Clone for PointerUsize
impl Clone for PointerUsize
Source§fn clone(&self) -> PointerUsize
fn clone(&self) -> PointerUsize
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PointerUsize
impl Debug for PointerUsize
Source§impl Default for PointerUsize
Construct a default value.
impl Default for PointerUsize
Construct a default value.
use syntree::pointer::Pointer;
use syntree::pointer::PointerUsize;
let v = PointerUsize::default();
assert_eq!(v.get(), 0);
Source§impl Hash for PointerUsize
impl Hash for PointerUsize
Source§impl Ord for PointerUsize
impl Ord for PointerUsize
Source§fn cmp(&self, other: &PointerUsize) -> Ordering
fn cmp(&self, other: &PointerUsize) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PointerUsize
impl PartialEq for PointerUsize
Source§impl PartialOrd for PointerUsize
impl PartialOrd for PointerUsize
Source§impl Pointer for PointerUsize
Pointer used for usize
type.
impl Pointer for PointerUsize
Pointer used for usize
type.
use syntree::pointer::Pointer;
use syntree::pointer::PointerUsize;
let v = PointerUsize::new(0).ok_or("out of bounds")?;
assert_eq!(v.get(), 0);
let v = PointerUsize::new(42).ok_or("out of bounds")?;
assert_eq!(v.get(), 42);
impl Copy for PointerUsize
impl Eq for PointerUsize
impl StructuralPartialEq for PointerUsize
Auto Trait Implementations§
impl Freeze for PointerUsize
impl RefUnwindSafe for PointerUsize
impl Send for PointerUsize
impl Sync for PointerUsize
impl Unpin for PointerUsize
impl UnwindSafe for PointerUsize
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