MCPcopy Create free account
hub / github.com/RustCrypto/utils / from_mut_slice

Method from_mut_slice

inout/src/reserved.rs:28–41  ·  view source on GitHub ↗

Crate [`InOutBufReserved`] from a single mutable slice. # Errors If `out` is too small.

(buf: &'a mut [T], msg_len: usize)

Source from the content-addressed store, hash-verified

26 /// # Errors
27 /// If `out` is too small.
28 pub fn from_mut_slice(buf: &'a mut [T], msg_len: usize) -> Result<Self, OutIsTooSmallError> {
29 if msg_len > buf.len() {
30 return Err(OutIsTooSmallError);
31 }
32 let p = buf.as_mut_ptr();
33 let out_len = buf.len();
34 Ok(Self {
35 in_ptr: p,
36 out_ptr: p,
37 in_len: msg_len,
38 out_len,
39 _pd: PhantomData,
40 })
41 }
42}
43
44impl<T> InOutBufReserved<'_, '_, T> {

Callers

nothing calls this directly

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected