Struct capnp::Word [−][src]
#[repr(C)]pub struct Word { /* fields omitted */ }
Eight bytes of memory with opaque interior. Use capnp_word!()
to construct one of these.
This type is used to ensure that the data of a message is properly aligned.
Methods
impl Word
[src]
impl Word
pub fn allocate_zeroed_vec(length: usize) -> Vec<Word>
[src]
pub fn allocate_zeroed_vec(length: usize) -> Vec<Word>
Does this, but faster:
::std::iter::repeat(Word(0)).take(length).collect()
pub unsafe fn bytes_to_words<'a>(bytes: &'a [u8]) -> &'a [Word]
[src]
pub unsafe fn bytes_to_words<'a>(bytes: &'a [u8]) -> &'a [Word]
Converts a byte slice into a Word
slice. Unsafe due to possible alignment issues.
Only call this if you know that either
bytes.to_ptr()
falls on an eight-byte boundary, or- your processor is okay with unaligned reads.
pub unsafe fn bytes_to_words_mut<'a>(bytes: &'a mut [u8]) -> &'a mut [Word]
[src]
pub unsafe fn bytes_to_words_mut<'a>(bytes: &'a mut [u8]) -> &'a mut [Word]
Converts a mutable byte slice into a mutable Word
slice. Unsafe due to possible
alignment issues. Only call this if you know that either
bytes.to_ptr()
falls on an eight-byte boundary, or- your processor is okay with unaligned reads and writes
pub fn words_to_bytes<'a>(words: &'a [Word]) -> &'a [u8]
[src]
pub fn words_to_bytes<'a>(words: &'a [Word]) -> &'a [u8]
pub fn words_to_bytes_mut<'a>(words: &'a mut [Word]) -> &'a mut [u8]
[src]
pub fn words_to_bytes_mut<'a>(words: &'a mut [Word]) -> &'a mut [u8]
Trait Implementations
impl Clone for Word
[src]
impl Clone for Word
fn clone(&self) -> Word
[src]
fn clone(&self) -> Word
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0
[src]Performs copy-assignment from source
. Read more
impl Copy for Word
[src]
impl Copy for Word
impl Debug for Word
[src]
impl Debug for Word
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for Word
[src]
impl PartialEq for Word
fn eq(&self, other: &Word) -> bool
[src]
fn eq(&self, other: &Word) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Word) -> bool
[src]
fn ne(&self, other: &Word) -> bool
This method tests for !=
.
impl Eq for Word
[src]
impl Eq for Word