#[non_exhaustive]pub struct Global;Expand description
Global buffer that can be used in combination with an Allocator.
This uses the global allocator.
§Examples
use musli::alloc::{Global, Vec};
let alloc = Global::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 Global
impl Allocator for Global
Source§fn __do_not_implement()
fn __do_not_implement()
Do not implement this trait. It is internal to Musli and will change.
Source§impl GlobalAllocator for Global
impl GlobalAllocator for Global
Source§fn __do_not_implement()
fn __do_not_implement()
Do not implement this trait. It is internal to Musli and will change.
Source§fn clone_alloc<T>(alloc: &Self::Alloc<T>) -> Self::Alloc<T>
fn clone_alloc<T>(alloc: &Self::Alloc<T>) -> Self::Alloc<T>
Clone an allocation.
impl Copy for Global
impl Eq for Global
impl StructuralPartialEq for Global
Auto Trait Implementations§
impl Freeze for Global
impl RefUnwindSafe for Global
impl Send for Global
impl Sync for Global
impl Unpin for Global
impl UnsafeUnpin for Global
impl UnwindSafe for Global
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