pub struct Ident {
pub idx: usize,
pub len: usize,
}Expand description
An Ident is used to identify a cached pointer.
Fields§
§idx: usize§len: usizeImplementations§
Source§impl Ident
impl Ident
Sourcepub fn new(len: usize) -> Ident
pub fn new(len: usize) -> Ident
Examples found in repository?
examples/cpu_cache.rs (line 15)
6fn main() {
7 let device = CPU::new();
8
9 let a = Matrix::<i16>::new(&device, (100, 100));
10 let b = Matrix::<i16>::new(&device, (100, 100));
11
12 let out = a + b;
13 let ptr = {
14 let cache = device.cache.borrow();
15 let mut node = Ident::new(100 * 100);
16 node.idx = 0;
17 cache.nodes.get(&node).unwrap().ptr
18 };
19
20 assert!(ptr == out.as_buf().ptr.ptr as *mut u8);
21}Trait Implementations§
Source§impl Ord for Ident
impl Ord for Ident
Source§impl PartialOrd for Ident
impl PartialOrd for Ident
impl Copy for Ident
impl Eq for Ident
impl StructuralPartialEq for Ident
Auto Trait Implementations§
impl Freeze for Ident
impl RefUnwindSafe for Ident
impl Send for Ident
impl Sync for Ident
impl Unpin for Ident
impl UnwindSafe for Ident
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