Struct rustbus::wire::marshal::traits::SignatureBuffer [−][src]
pub struct SignatureBuffer(_);
SignatureBuffer
is used to store static or dynamic signatures and avoid allocations if possible.
It is a wrapper around Cow.
Implementations
impl SignatureBuffer
[src]
impl SignatureBuffer
[src]pub fn new() -> Self
[src]
pub fn push_static(&mut self, sig: &'static str)
[src]
Pushes a &str
into the signature buffer.
Avoids an allocation if the self
was empty and was not allocated already,
by storing the &'static str
inside a Cow::Borrowed
variant.
pub fn push_str(&mut self, sig: &str)
[src]
Pushes a &str
into the signature buffer.
If sig
has a 'static
lifetime then SignatureBuffer::push_static
should almost always be used
instead of this, because it can provide a performance benefit by avoiding allocation.
pub fn to_string_mut(&mut self) -> &mut String
[src]
Return a &mut String
which can be used to modify the signature.
Internally this is just a call to Cow::to_mut
.
pub fn clear(&mut self)
[src]
Clear the signature.
If an allocation was already made it is retained for future use.
If you wish to deallocate when clearing, then simply use SignatureBuffer::new
.
pub fn from_string(sig: String) -> Self
[src]
pub fn as_str(&self) -> &str
[src]
Trait Implementations
impl Default for SignatureBuffer
[src]
impl Default for SignatureBuffer
[src]