pub struct ReadOnlyMemory<T> { /* private fields */ }Expand description
An immutable, reference counted slice of a shared buffer.
Cloning and slicing never copy the elements; they bump one reference count.
Implementations§
Source§impl<T> ReadOnlyMemory<T>
impl<T> ReadOnlyMemory<T>
Sourcepub fn with_range(owner: Rc<[T]>, start: usize, length: usize) -> Self
pub fn with_range(owner: Rc<[T]>, start: usize, length: usize) -> Self
Wraps length elements of a shared buffer starting at start.
Panics when the range is outside the buffer.
Sourcepub fn slice_from(&self, start: usize) -> Self
pub fn slice_from(&self, start: usize) -> Self
The elements from start to the end (C# Slice(start)).
Panics when start is outside the memory.
Sourcepub fn slice(&self, start: usize, length: usize) -> Self
pub fn slice(&self, start: usize, length: usize) -> Self
length elements starting at start (C# Slice(start, length)).
Panics when the range is outside the memory.
Sourcepub fn offset_in_owner(&self) -> usize
pub fn offset_in_owner(&self) -> usize
The offset of this memory inside its underlying buffer.
Whether both memories view the same buffer (regardless of range).
Source§impl<T: Clone> ReadOnlyMemory<T>
impl<T: Clone> ReadOnlyMemory<T>
Source§impl ReadOnlyMemory<u16>
impl ReadOnlyMemory<u16>
Trait Implementations§
Source§impl<T> Clone for ReadOnlyMemory<T>
impl<T> Clone for ReadOnlyMemory<T>
Source§impl<T: Debug> Debug for ReadOnlyMemory<T>
impl<T: Debug> Debug for ReadOnlyMemory<T>
Source§impl<T> Default for ReadOnlyMemory<T>
impl<T> Default for ReadOnlyMemory<T>
Source§impl<T> From<Vec<T>> for ReadOnlyMemory<T>
impl<T> From<Vec<T>> for ReadOnlyMemory<T>
Source§impl<T: PartialEq> PartialEq for ReadOnlyMemory<T>
Element-wise equality (unlike C#, where ReadOnlyMemory<T>.Equals compares
the underlying object and range; use ReadOnlyMemory::shares_owner_with
for that).
impl<T: PartialEq> PartialEq for ReadOnlyMemory<T>
Element-wise equality (unlike C#, where ReadOnlyMemory<T>.Equals compares
the underlying object and range; use ReadOnlyMemory::shares_owner_with
for that).
Auto Trait Implementations§
impl<T> !Send for ReadOnlyMemory<T>
impl<T> !Sync for ReadOnlyMemory<T>
impl<T> Freeze for ReadOnlyMemory<T>
impl<T> RefUnwindSafe for ReadOnlyMemory<T>
impl<T> Unpin for ReadOnlyMemory<T>
impl<T> UnsafeUnpin for ReadOnlyMemory<T>
impl<T> UnwindSafe for ReadOnlyMemory<T>
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more