Struct BorrowedBuf

Source
pub struct BorrowedBuf<'data> { /* private fields */ }
๐Ÿ”ฌThis is a nightly-only experimental API. (core_io_borrowed_buf)
Expand description

A borrowed byte buffer which is incrementally filled and initialized.

This type is a sort of โ€œdouble cursorโ€. It tracks three regions in the buffer: a region at the beginning of the buffer that has been logically filled with data, a region that has been initialized at some point but not yet logically filled, and a region at the end that is fully uninitialized. The filled region is guaranteed to be a subset of the initialized region.

In summary, the contents of the buffer can be visualized as:

[             capacity              ]
[ filled |         unfilled         ]
[    initialized    | uninitialized ]

A BorrowedBuf is created around some existing data (or capacity for data) via a unique reference (&mut). The BorrowedBuf can be configured (e.g., using clear or set_init), but cannot be directly written. To write into the buffer, use unfilled to create a BorrowedCursor. The cursor has write-only access to the unfilled portion of the buffer (you can think of it as a write-only iterator).

The lifetime 'data is a bound on the lifetime of the underlying data.

Implementationsยง

Sourceยง

impl<'data> BorrowedBuf<'data>

Source

pub fn capacity(&self) -> usize

๐Ÿ”ฌThis is a nightly-only experimental API. (core_io_borrowed_buf)

Returns the total capacity of the buffer.

Source

pub fn len(&self) -> usize

๐Ÿ”ฌThis is a nightly-only experimental API. (core_io_borrowed_buf)

Returns the length of the filled part of the buffer.

Source

pub fn init_len(&self) -> usize

๐Ÿ”ฌThis is a nightly-only experimental API. (core_io_borrowed_buf)

Returns the length of the initialized part of the buffer.

Source

pub fn filled(&self) -> &[u8] โ“˜

๐Ÿ”ฌThis is a nightly-only experimental API. (core_io_borrowed_buf)

Returns a shared reference to the filled portion of the buffer.

Source

pub fn filled_mut(&mut self) -> &mut [u8] โ“˜

๐Ÿ”ฌThis is a nightly-only experimental API. (core_io_borrowed_buf)

Returns a mutable reference to the filled portion of the buffer.

Source

pub fn into_filled(self) -> &'data [u8] โ“˜

๐Ÿ”ฌThis is a nightly-only experimental API. (core_io_borrowed_buf)

Returns a shared reference to the filled portion of the buffer with its original lifetime.

Source

pub fn into_filled_mut(self) -> &'data mut [u8] โ“˜

๐Ÿ”ฌThis is a nightly-only experimental API. (core_io_borrowed_buf)

Returns a mutable reference to the filled portion of the buffer with its original lifetime.

Source

pub fn unfilled<'this>(&'this mut self) -> BorrowedCursor<'this> โ“˜

๐Ÿ”ฌThis is a nightly-only experimental API. (core_io_borrowed_buf)

Returns a cursor over the unfilled part of the buffer.

Source

pub fn clear(&mut self) -> &mut BorrowedBuf<'data>

๐Ÿ”ฌThis is a nightly-only experimental API. (core_io_borrowed_buf)

Clears the buffer, resetting the filled region to empty.

The number of initialized bytes is not changed, and the contents of the buffer are not modified.

Source

pub unsafe fn set_init(&mut self, n: usize) -> &mut BorrowedBuf<'data>

๐Ÿ”ฌThis is a nightly-only experimental API. (core_io_borrowed_buf)

Asserts that the first n bytes of the buffer are initialized.

BorrowedBuf assumes that bytes are never de-initialized, so this method does nothing when called with fewer bytes than are already known to be initialized.

ยงSafety

The caller must ensure that the first n unfilled bytes of the buffer have already been initialized.

Trait Implementationsยง

Sourceยง

impl Debug for BorrowedBuf<'_>

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Sourceยง

impl<'data> From<&'data mut [MaybeUninit<u8>]> for BorrowedBuf<'data>

Creates a new BorrowedBuf from an uninitialized buffer.

Use set_init if part of the buffer is known to be already initialized.

Sourceยง

fn from(buf: &'data mut [MaybeUninit<u8>]) -> BorrowedBuf<'data>

Converts to this type from the input type.
Sourceยง

impl<'data> From<&'data mut [u8]> for BorrowedBuf<'data>

Creates a new BorrowedBuf from a fully initialized slice.

Sourceยง

fn from(slice: &'data mut [u8]) -> BorrowedBuf<'data>

Converts to this type from the input type.
Sourceยง

impl<'data> From<BorrowedCursor<'data>> for BorrowedBuf<'data>

Creates a new BorrowedBuf from a cursor.

Use BorrowedCursor::with_unfilled_buf instead for a safer alternative.

Sourceยง

fn from(buf: BorrowedCursor<'data>) -> BorrowedBuf<'data>

Converts to this type from the input type.

Auto Trait Implementationsยง

ยง

impl<'data> Freeze for BorrowedBuf<'data>

ยง

impl<'data> RefUnwindSafe for BorrowedBuf<'data>

ยง

impl<'data> Send for BorrowedBuf<'data>

ยง

impl<'data> Sync for BorrowedBuf<'data>

ยง

impl<'data> Unpin for BorrowedBuf<'data>

ยง

impl<'data> !UnwindSafe for BorrowedBuf<'data>

Blanket Implementationsยง

Sourceยง

impl<T> AggregateExpressionMethods for T

Sourceยง

fn aggregate_distinct(self) -> Self::Output
where Self: DistinctDsl,

DISTINCT modifier for aggregate functions Read more
Sourceยง

fn aggregate_all(self) -> Self::Output
where Self: AllDsl,

ALL modifier for aggregate functions Read more
Sourceยง

fn aggregate_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add an aggregate function filter Read more
Sourceยง

fn aggregate_order<O>(self, o: O) -> Self::Output
where Self: OrderAggregateDsl<O>,

Add an aggregate function order Read more
Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> Downcast for T
where T: Any,

Sourceยง

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Sourceยง

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Sourceยง

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Anyโ€™s vtable from &Traitโ€™s.
Sourceยง

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Anyโ€™s vtable from &mut Traitโ€™s.
Sourceยง

impl<T> DowncastSend for T
where T: Any + Send,

Sourceยง

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Sourceยง

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Sourceยง

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Sourceยง

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> IntoEither for T

Sourceยง

fn into_either(self, into_left: bool) -> Either<Self, Self> โ“˜

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ“˜
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Sourceยง

impl<T> IntoSql for T

Sourceยง

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Dieselโ€™s query builder. Read more
Sourceยง

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Dieselโ€™s query builder. Read more
Sourceยง

impl<T> Pointable for T

Sourceยง

const ALIGN: usize

The alignment of pointer.
Sourceยง

type Init = T

The type for initializers.
Sourceยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Sourceยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Sourceยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Sourceยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
Sourceยง

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Sourceยง

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Sourceยง

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Sourceยง

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Sourceยง

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Sourceยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Sourceยง

fn vzip(self) -> V

Sourceยง

impl<T> WindowExpressionMethods for T

Sourceยง

fn over(self) -> Self::Output
where Self: OverDsl,

Turn a function call into a window function call Read more
Sourceยง

fn window_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add a filter to the current window function Read more
Sourceยง

fn partition_by<E>(self, expr: E) -> Self::Output
where Self: PartitionByDsl<E>,

Add a partition clause to the current window function Read more
Sourceยง

fn window_order<E>(self, expr: E) -> Self::Output
where Self: OrderWindowDsl<E>,

Add a order clause to the current window function Read more
Sourceยง

fn frame_by<E>(self, expr: E) -> Self::Output
where Self: FrameDsl<E>,

Add a frame clause to the current window function Read more
Sourceยง

impl<T> ErasedDestructor for T
where T: 'static,