MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / as_slice

Method as_slice

crates/cust/src/memory/unified.rs:443–445  ·  view source on GitHub ↗

Extracts a slice containing the entire buffer. Equivalent to `&s[..]`. # Examples ``` # let _context = cust::quick_init().unwrap(); use cust::memory::*; let buffer = UnifiedBuffer::new(&0u64, 5).unwrap(); let sum : u64 = buffer.as_slice().iter().sum(); ```

(&self)

Source from the content-addressed store, hash-verified

441 /// let sum : u64 = buffer.as_slice().iter().sum();
442 /// ```
443 pub fn as_slice(&self) -> &[T] {
444 self
445 }
446
447 /// Extracts a mutable slice of the entire buffer.
448 ///

Callers 11

mainFunction · 0.45
newMethod · 0.45
resizeMethod · 0.45
mainFunction · 0.45
as_device_ptrMethod · 0.45
prefetch_to_hostMethod · 0.45
prefetch_to_deviceMethod · 0.45
advise_read_mostlyMethod · 0.45
preferred_locationMethod · 0.45
find_llvm_configFunction · 0.45

Calls 3

as_unified_ptrMethod · 0.80
from_raw_partsFunction · 0.70
as_rawMethod · 0.45

Tested by

no test coverage detected