#[non_exhaustive]pub struct System;Available on crate feature
alloc only.Expand description
System buffer that can be used in combination with an Allocator.
This uses the System allocator.
§Examples
use musli::alloc::{System, Vec};
let alloc = System::new();
let mut buf1 = Vec::new_in(alloc);
let mut buf2 = Vec::new_in(alloc);
buf1.extend_from_slice(b"Hello, ")?;
buf2.extend_from_slice(b"world!")?;
assert_eq!(buf1.as_slice(), b"Hello, ");
assert_eq!(buf2.as_slice(), b"world!");
buf1.extend(buf2);
assert_eq!(buf1.as_slice(), b"Hello, world!");Implementations§
Trait Implementations§
Source§impl Allocator for System
impl Allocator for System
Source§const IS_SYSTEM: bool = true
const IS_SYSTEM: bool = true
Whether the allocations returned by this allocatore is backed by the
system allocator or not. Read more
Source§type Alloc<T> = SystemAlloc<T>
type Alloc<T> = SystemAlloc<T>
A raw allocation from the allocator.
Source§fn alloc<T>(self, value: T) -> Result<Self::Alloc<T>, AllocError>
fn alloc<T>(self, value: T) -> Result<Self::Alloc<T>, AllocError>
Construct an empty uninitialized raw allocation with an alignment
matching that of
T that is associated with this allocator. Read moreSource§fn alloc_empty<T>(self) -> Self::Alloc<T>
fn alloc_empty<T>(self) -> Self::Alloc<T>
Construct an empty uninitialized raw vector with an alignment matching
that of
T that is associated with this allocator. Read moreimpl Copy for System
Auto Trait Implementations§
impl Freeze for System
impl RefUnwindSafe for System
impl Send for System
impl Sync for System
impl Unpin for System
impl UnwindSafe for System
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