Struct zenoh_protocol::io::WBuf
source · pub struct WBuf { /* private fields */ }Expand description
A writable zenoh buffer.
Implementations§
source§impl WBuf
impl WBuf
pub fn new(capacity: usize, contiguous: bool) -> WBuf ⓘ
pub fn capacity(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
pub fn get_first_slice<R>(&self, range: R) -> &[u8] ⓘwhere
R: RangeBounds<usize>,
pub fn get_first_slice_mut<R>(&mut self, range: R) -> &mut [u8] ⓘwhere
R: RangeBounds<usize>,
pub fn reader(&self) -> WBufReader<'_>
Trait Implementations§
source§impl AsMut<WBuf> for WBufWriter
impl AsMut<WBuf> for WBufWriter
source§impl AsRef<WBuf> for WBufWriter
impl AsRef<WBuf> for WBufWriter
source§impl ConstructibleBuffer for WBuf
impl ConstructibleBuffer for WBuf
source§impl CopyBuffer for WBuf
impl CopyBuffer for WBuf
source§fn write(&mut self, bytes: &[u8]) -> Option<NonZeroUsize>
fn write(&mut self, bytes: &[u8]) -> Option<NonZeroUsize>
Copies as much of
bytes as possible inside its cache, returning the amount actually written.
Will return None if the write was refused.fn write_byte(&mut self, byte: u8) -> Option<NonZeroUsize>
source§impl From<WBuf> for WBufWriter
impl From<WBuf> for WBufWriter
source§fn from(inner: WBuf) -> WBufWriter
fn from(inner: WBuf) -> WBufWriter
Converts to this type from the input type.
source§impl Indexable for WBuf
impl Indexable for WBuf
source§impl<T> InsertBuffer<T> for WBufwhere
T: Into<ZSlice>,
impl<T> InsertBuffer<T> for WBufwhere
T: Into<ZSlice>,
source§fn append(&mut self, slice: T) -> Option<NonZeroUsize>
fn append(&mut self, slice: T) -> Option<NonZeroUsize>
Appends a slice to the buffer without copying its data.
source§impl MessageWriter for WBuf
impl MessageWriter for WBuf
fn write_deco_attachment(&mut self, attachment: &Attachment) -> bool
fn write_deco_routing_context(
&mut self,
routing_context: &RoutingContext
) -> bool
fn write_deco_reply_context(&mut self, reply_context: &ReplyContext) -> bool
fn write_deco_priority(&mut self, priority: Priority) -> bool
fn write_transport_message(&mut self, msg: &mut TransportMessage) -> bool
fn write_frame(&mut self, frame: &mut Frame) -> bool
fn write_scout(&mut self, scout: &Scout) -> bool
fn write_hello(&mut self, hello: &Hello) -> bool
fn write_init_syn(&mut self, init_syn: &InitSyn) -> bool
fn write_init_ack(&mut self, init_ack: &InitAck) -> bool
fn write_open_syn(&mut self, open_syn: &OpenSyn) -> bool
fn write_open_ack(&mut self, open_ack: &OpenAck) -> bool
fn write_join(&mut self, join: &Join) -> bool
fn write_close(&mut self, close: &Close) -> bool
fn write_sync(&mut self, sync: &Sync) -> bool
fn write_ack_nack(&mut self, ack_nack: &AckNack) -> bool
fn write_keep_alive(&mut self, keep_alive: &KeepAlive) -> bool
fn write_ping(&mut self, ping: &Ping) -> bool
fn write_pong(&mut self, pong: &Pong) -> bool
fn write_frame_header(
&mut self,
priority: Priority,
reliability: Reliability,
sn: ZInt,
is_fragment: Option<bool>,
attachment: Option<Attachment>
) -> bool
fn write_zenoh_message(&mut self, msg: &mut ZenohMessage) -> bool
fn write_data(&mut self, data: &Data) -> bool
fn write_key_expr(&mut self, key: &WireExpr<'_>) -> bool
fn write_data_info(&mut self, info: &DataInfo) -> bool
fn write_queryable_info(&mut self, info: &QueryableInfo) -> bool
fn write_declare(&mut self, declare: &Declare) -> bool
fn write_declaration(&mut self, declaration: &Declaration) -> bool
fn write_submode(&mut self, mode: &SubMode) -> bool
fn write_unit(&mut self, unit: &Unit) -> bool
fn write_pull(&mut self, pull: &Pull) -> bool
fn write_query(&mut self, query: &Query) -> bool
fn write_link_state_list(&mut self, link_state_list: &LinkStateList) -> bool
fn write_link_state(&mut self, link_state: &LinkState) -> bool
fn write_query_target(&mut self, target: &QueryTarget) -> bool
fn write_consolidation_mode(mode: ConsolidationMode) -> ZInt
fn write_consolidation(&mut self, consolidation: ConsolidationMode) -> bool
source§impl<'a> SplitBuffer<'a> for WBuf
impl<'a> SplitBuffer<'a> for WBuf
type Slices = Box<dyn ByteSliceExactIter<'a, Item = &'a [u8]> + 'a, Global>
source§fn slices(&'a self) -> <WBuf as SplitBuffer<'a>>::Slices ⓘ
fn slices(&'a self) -> <WBuf as SplitBuffer<'a>>::Slices ⓘ
Gets all the slices of this buffer.
source§fn contiguous(&'a self) -> Cow<'a, [u8]>
fn contiguous(&'a self) -> Cow<'a, [u8]>
Returns all the bytes of this buffer in a conitguous slice.
This may require allocation and copy if the original buffer
is not contiguous.
source§impl WBufCodec for WBuf
impl WBufCodec for WBuf
source§fn write_zint(&mut self, v: ZInt) -> bool
fn write_zint(&mut self, v: ZInt) -> bool
This the traditional VByte encoding, in which an arbirary integer is encoded as a sequence of 7 bits integers
fn write_u64_as_zint(&mut self, v: u64) -> bool
fn write_usize_as_zint(&mut self, v: usize) -> bool
fn write_bytes_array(&mut self, s: &[u8]) -> bool
fn write_string(&mut self, s: &str) -> bool
fn write_zid(&mut self, zid: &ZenohId) -> bool
fn write_locator(&mut self, locator: &Locator) -> bool
fn write_locators(&mut self, locators: &[Locator]) -> bool
fn write_zslice_array(&mut self, slice: ZSlice) -> bool
fn write_zbuf_flat(&mut self, zbuf: &ZBuf) -> bool
fn write_zbuf(&mut self, zbuf: &ZBuf) -> bool
fn write_zbuf_slices(&mut self, zbuf: &ZBuf) -> bool
fn write_properties(&mut self, props: &[Property]) -> bool
fn write_property(&mut self, p: &Property) -> bool
fn write_timestamp(&mut self, tstamp: &Timestamp) -> bool
source§impl Write for WBuf
impl Write for WBuf
source§fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
Write a buffer into this writer, returning how many bytes were written. Read more
source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
source§fn flush(&mut self) -> Result<(), Error>
fn flush(&mut self) -> Result<(), Error>
Flush this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored)Attempts to write multiple buffers into this writer. Read more