Struct grpcio::GrpcSlice [−][src]
#[repr(C)]pub struct GrpcSlice(_);
Expand description
A convenient rust wrapper for the type grpc_slice
.
It’s expected that the slice should be initialized.
Implementations
impl GrpcSlice
[src]
impl GrpcSlice
[src]pub fn is_empty(&self) -> bool
[src]
pub fn from_static_slice(s: &'static [u8]) -> GrpcSlice
[src]
pub fn from_static_slice(s: &'static [u8]) -> GrpcSlice
[src]Creates a slice from static rust slice.
Same as From<&[u8]>
but without copying the buffer.
pub fn from_static_str(s: &'static str) -> GrpcSlice
[src]
pub fn from_static_str(s: &'static str) -> GrpcSlice
[src]Creates a GrpcSlice
from static rust str.
Same as from_str
but without allocation.
pub unsafe fn realloc(&mut self, cap: usize) -> &mut [MaybeUninit<u8>]
[src]
pub unsafe fn realloc(&mut self, cap: usize) -> &mut [MaybeUninit<u8>]
[src]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.
pub fn as_mut_ptr(&mut self) -> *mut grpc_slice
[src]
Trait Implementations
impl From<&'_ [u8]> for GrpcSlice
[src]
impl From<&'_ [u8]> for GrpcSlice
[src]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.
impl From<&'_ CStr> for GrpcSlice
[src]
impl From<&'_ CStr> for GrpcSlice
[src]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.
impl From<&'_ str> for GrpcSlice
[src]
impl From<&'_ str> for GrpcSlice
[src]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.
impl From<CString> for GrpcSlice
[src]
impl From<CString> for GrpcSlice
[src]Creates a GrpcSlice
from rust cstring.
If the cstring can’t fit inline, there will be allocations.
impl From<String> for GrpcSlice
[src]
impl From<String> for GrpcSlice
[src]Creates a GrpcSlice
from rust string.
If the string can’t fit inline, there will be allocations.
impl Send for GrpcSlice
[src]
impl Sync for GrpcSlice
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more