Struct domain::bits::compose::ComposeSnapshot[][src]

pub struct ComposeSnapshot { /* fields omitted */ }

A snapshot of a composer’s state.

This type is actually a composer all by itself, that is, it implements AsMut<Composer>. However, if necessary, it can be rolled back to the state the composer had when it was created forgetting about all changes made since.

This process currently is not transitive. While a new snapshot can be created from both a composer and a snapshot, when you roll back you get a composer. Ie., you can only roll back once. This is enough for the purpose, reuse of messages when transitioning through several servers in a resolver.

Methods

impl ComposeSnapshot
[src]

Creates a new snapshot from the given composer.

Rewinds the state to when the snapshot was taken.

Rolls back to a composer with state as when the snapshot was taken.

Trades in the snapshot to a composer with all changes commited.

Methods from Deref<Target = Composer>

Returns a reference to the underlying vector as it looks now.

This method updates the length shim in stream mode, hence the need for a &mut self.

Returns the message bytes as far as they are assembled yet.

The returned bytes slice really only contains the message bytes and neither whatever was contained in the vector with which the composer was posssibly created nor the length prefix of stream mode.

Returns the message bytes as far as they are assembled yet.

The returned bytes slice really only contains the message bytes and neither whatever was contained in the vector with which the composer was posssibly created nor the length prefix of stream mode.

Returns the current position.

The returned value is identical to the current overall length of the underlying bytes vec.

Returns the position where the message starts.

This is identical to having called self.pos() right after self was created.

Returns the length of data added since the given position.

Panics

Panics if pos is larger than the current position.

Marks the current position as a point for truncation.

If the length of the resulting message exceeds its predefined maximum size for the first time after a call to this method, the data will be cut back to the length it had when the method was called. If this happens, any further writing will fail.

Returns whether the target has been truncated.

Pushes a bytes slice to the end of the message.

Pushes placeholder bytes to the end of the message.

In particular, if successful, the message will have been extended by len octets of value zero,

Pushes a single octet to the end of the message.

Pushes an unsigned 16-bit word to the end of the message.

Since DNS data is big-endian, data will be converted to that endianess if necessary.

Pushes a unsigned 32-bit word to the end of the message.

Since DNS data is big-endian, data will be converted to that endianess if necessary.

Pushes a domain name to the end of the message.

Pushes a domain name to the end of the message using name compression.

Since compression is only allowed in a few well-known places per RFC 1123 and RFC 3597, this isn’t the default behaviour.

Updates the bytes starting at the given position.

Panics

Panics if the bytes slice is longer than the data assembled since the given position.

Updates the octet at the given position.

Panics

Panics if there has not been at least one byte of data assembled since the given position.

Updates an unsigned 16-bit word starting at the given position.

Panics

Panics if there has not been at least two bytes of data assembled since the given position.

Updates an unsigned 32-bit word starting at the given position.

Panics

Panics if there has not been at least four bytes of data assembled since the given position.

Trait Implementations

impl Clone for ComposeSnapshot
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for ComposeSnapshot
[src]

Formats the value using the given formatter. Read more

impl Deref for ComposeSnapshot
[src]

The resulting type after dereferencing.

Dereferences the value.

impl DerefMut for ComposeSnapshot
[src]

Mutably dereferences the value.

impl AsRef<Composer> for ComposeSnapshot
[src]

Performs the conversion.

impl AsMut<Composer> for ComposeSnapshot
[src]

Performs the conversion.

Auto Trait Implementations