Struct mbpr::Request [] [src]

pub struct Request<'a> { /* fields omitted */ }

Memcached Request Packet

The whole thing

Methods

impl<'a> Request<'a>
[src]

Parse and borrow a packet from a buffer

This interface does ABSOLUTELY NO verfication of the packet it is expected if you are calling this method you understand the memcached protocol and you are going to use this to generate a valid packet.

The goal of this interface is to be fast. Encoding a packet with this interface + Encode trait involves very few branches

Memcached only allows Keys that are ASCII and non-white space this interface does not do ANY assertions of this. Please be aware.

Over write an existing request

This is provided to allow for easier interfacing with SLAB's. The semantics of this method are identical to the above. The primary difference is this doesn't push ~100 bytes to the stack.

This interface does ABSOLUTELY NO verfication of the packet it is expected if you are calling this method you understand the memcached protocol and you are going to use this to generate a valid packet.

The goal of this interface is to be fast. Encoding a packet with this interface + Encode trait involves very few branches

Memcached only allows Keys that are ASCII and non-white space this interface does not do ANY assertions of this. Please be aware.

Allocates a new buffer and encodes this packets contents into it. this method works out to a handful of memcp primatives and is fairly quick as their is no bounds checking (buffer length is asserted on construction).

If you are using a slab to avoid making too many allocations this method will check check the Vec<u8> it is passed only reserving additional capacity if necessary. If the Vec<u8> has enough capacity no action is taken.

The standard states the key should be an ASCII compatible string so this method preforms that conversion without checking for correctness.

This isnt a problem as the key will be hash/stored as a byte buffer anyways.

This really only opens the door to non standard things.

Consume this item and take ownership

If a field is Option::None the resulting vector will be a Vec::with_capacity(0) which does not allocate. So this method can be cheap depending on the messages contents.

Trait Implementations

impl<'a> Clone for Request<'a>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a> Debug for Request<'a>
[src]

Formats the value using the given formatter.

impl<'a> PacketVal for Request<'a>
[src]

Get size of Packet's Key Field

Get size of Packet's Body Field (Raw Data)

Get size of Packet's Extra Field (Flags, Arguments, Etc. command specific)

The total length of the packet

impl<'a> Encoding for Request<'a>
[src]

Encode a packet