#[repr(transparent)]
pub struct GrpcSlice(_);
Expand description

A convenient rust wrapper for the type grpc_slice.

It’s expected that the slice should be initialized.

Implementations

Get the length of the data.

Returns a slice of inner buffer.

Creates a slice from static rust slice.

Same as From<&[u8]> but without copying the buffer.

Creates a GrpcSlice from static rust str.

Same as from_str but without allocation.

Checks whether the slice stores bytes inline.

Reallocates current slice with given capacity.

The length of returned slice is the exact same as given cap.

Safety

Caller is expected to initialize all available bytes to guarantee safety of this slice.

Trait Implementations

Clone the slice.

If the slice is not inlined, the reference count will be increased instead of copy.

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns a default slice, which is empty.

Executes the destructor for this type. Read more

Creates a GrpcSlice from rust slice.

The data inside slice will be cloned. If the data can’t fit inline, necessary buffer will be allocated.

Converts to this type from the input type.

Creates a GrpcSlice from rust CStr.

The data inside CStr will be cloned. If the data can’t fit inline, necessary buffer will be allocated.

Converts to this type from the input type.

Creates a GrpcSlice from rust str.

The data inside str will be cloned. If the data can’t fit inline, necessary buffer will be allocated.

Converts to this type from the input type.

Creates a GrpcSlice from rust cstring.

If the cstring can’t fit inline, there will be allocations.

Converts to this type from the input type.

Creates a GrpcSlice from rust string.

If the string can’t fit inline, there will be allocations.

Converts to this type from the input type.

Converts a Vec<u8> into GrpcSlice.

If v can’t fit inline, there will be allocations.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.