Trait async_rustbus::rustbus_core::wire::marshal::traits::Signature [−][src]
pub trait Signature {
pub fn signature() -> Type;
pub fn alignment() -> usize;
pub unsafe fn valid_slice(_bo: ByteOrder) -> bool { ... }
pub fn sig_str(s_buf: &mut SignatureBuffer) { ... }
}Required methods
Loading content...Provided methods
pub unsafe fn valid_slice(_bo: ByteOrder) -> bool[src]
If this returns true,
it indicates that for implementing type T,
Rust’s [T] is identical to DBus’s array format
and can be copied into a message after aligning the first element.
The default implementation is false but can be overridden for a performance gain
if it is valid.
Safety
Calls to this function should always be safe. Implementors should respect this property.
The reason this method is unsafe is to indicate to people implementing Signature that
overriding it has the potential to induce unsound behavior
if the following rules aren’t followed:
- The type
TimplementingSignaturemust beCopy. - The size of
Tmust be equivalent to it’s DBus alignment (see here). - Every possible bit-pattern must represent a valid instance of
T. For examplestd::num::NonZeroU32does not meet this requirement0is invalid. - The type should not contain an Fd receieved from the message.
When implementing
Unmarshalthe type should only dependent the'buflifetime. It should never require the use of'fds.
Notes
- This method exists because of limitiation with Rust type system.
Should
#[feature(specialization)]ever become stablized this will hopefully be unnecessary. - This method should use the
ByteOrderto check if it matches native order before returningtrue.ByteOrder::NATIVEcan be used to detect the native order.
pub fn sig_str(s_buf: &mut SignatureBuffer)[src]
Appends the signature of the type to the SignatureBuffer.
By using SignatureBuffer, implementations of this method can avoid unnecessary allocations
by only allocating if a signature is dynamic.
The default implementation of sig_str can be pretty slow.
If type, that Signature is being implemented for, has a static (unchanging) signature
then overriding this method can have a significant performance benefit when marshal/unmarshalling
the type inside variants.
Implementations on Foreign Types
impl<'_, E> Signature for &'_ [E] where
E: Signature, [src]
impl<'_, E> Signature for &'_ [E] where
E: Signature, [src]impl<'_, E> Signature for Cow<'_, [E]> where
E: Signature + Clone, [src]
impl<'_, E> Signature for Cow<'_, [E]> where
E: Signature + Clone, [src]impl<E1, E2, E3> Signature for (E1, E2, E3) where
E1: Signature,
E2: Signature,
E3: Signature, [src]
impl<E1, E2, E3> Signature for (E1, E2, E3) where
E1: Signature,
E2: Signature,
E3: Signature, [src]impl Signature for i64[src]
impl Signature for i64[src]impl<E> Signature for Vec<E, Global> where
E: Signature, [src]
impl<E> Signature for Vec<E, Global> where
E: Signature, [src]impl<E1, E2, E3, E4, E5> Signature for (E1, E2, E3, E4, E5) where
E1: Signature,
E2: Signature,
E3: Signature,
E4: Signature,
E5: Signature, [src]
impl<E1, E2, E3, E4, E5> Signature for (E1, E2, E3, E4, E5) where
E1: Signature,
E2: Signature,
E3: Signature,
E4: Signature,
E5: Signature, [src]impl Signature for i32[src]
impl Signature for i32[src]impl<E> Signature for (E,) where
E: Signature, [src]
impl<E> Signature for (E,) where
E: Signature, [src]impl<E> Signature for [E] where
E: Signature, [src]
impl<E> Signature for [E] where
E: Signature, [src]impl Signature for u16[src]
impl Signature for u16[src]impl Signature for i16[src]
impl Signature for i16[src]impl Signature for u8[src]
impl Signature for u8[src]impl Signature for bool[src]
impl Signature for bool[src]impl Signature for String[src]
impl Signature for String[src]impl<'_> Signature for &'_ str[src]
impl<'_> Signature for &'_ str[src]impl<'_, S> Signature for &'_ S where
S: Signature, [src]
impl<'_, S> Signature for &'_ S where
S: Signature, [src]impl<E1, E2> Signature for (E1, E2) where
E1: Signature,
E2: Signature, [src]
impl<E1, E2> Signature for (E1, E2) where
E1: Signature,
E2: Signature, [src]impl Signature for u32[src]
impl Signature for u32[src]impl Signature for u64[src]
impl Signature for u64[src]impl<'_> Signature for &'_ (dyn AsRawFd + '_)[src]
impl<'_> Signature for &'_ (dyn AsRawFd + '_)[src]impl<K, V> Signature for HashMap<K, V, RandomState> where
K: Signature,
V: Signature, [src]
impl<K, V> Signature for HashMap<K, V, RandomState> where
K: Signature,
V: Signature, [src]impl<E1, E2, E3, E4> Signature for (E1, E2, E3, E4) where
E1: Signature,
E2: Signature,
E3: Signature,
E4: Signature, [src]
impl<E1, E2, E3, E4> Signature for (E1, E2, E3, E4) where
E1: Signature,
E2: Signature,
E3: Signature,
E4: Signature, [src]Implementors
impl Signature for &async_rustbus::rustbus_core::path::ObjectPath[src]
impl Signature for &async_rustbus::rustbus_core::path::ObjectPath[src]impl Signature for ObjectPathBuf[src]
impl Signature for ObjectPathBuf[src]impl<'_> Signature for SignatureWrapper<'_>[src]
impl<'_> Signature for SignatureWrapper<'_>[src]impl<'a, E> Signature for OptimizedMarshal<'a, E> where
E: Copy + Marshal, [src]
impl<'a, E> Signature for OptimizedMarshal<'a, E> where
E: Copy + Marshal, [src]