[][src]Enum mongodb::wire_protocol::operations::Message

pub enum Message {
    OpReply {
        header: Header,
        flags: OpReplyFlags,
        cursor_id: i64,
        starting_from: i32,
        number_returned: i32,
        documents: Vec<Document>,
    },
    OpUpdate {
        header: Header,
        namespace: String,
        flags: OpUpdateFlags,
        selector: Document,
        update: Document,
    },
    OpInsert {
        header: Header,
        flags: OpInsertFlags,
        namespace: String,
        documents: Vec<Document>,
    },
    OpQuery {
        header: Header,
        flags: OpQueryFlags,
        namespace: String,
        number_to_skip: i32,
        number_to_return: i32,
        query: Document,
        return_field_selector: Option<Document>,
    },
    OpGetMore {
        header: Header,
        namespace: String,
        number_to_return: i32,
        cursor_id: i64,
    },
}

Represents a message in the MongoDB Wire Protocol.

Variants

OpReply

Fields of OpReply

header: Header

The message header.

flags: OpReplyFlags

A Bit vector of reply options.

cursor_id: i64

Uniquely identifies the cursor being returned.

starting_from: i32

The starting position for the cursor.

number_returned: i32

The total number of documents being returned.

documents: Vec<Document>

The documents being returned.

OpUpdate

Fields of OpUpdate

header: Header

The message header.

namespace: String

The full qualified name of the collection, beginning with the database name and a dot separator.

flags: OpUpdateFlags

A bit vector of update options.

selector: Document

Identifies the document(s) to be updated.

update: Document

Instruction document for how to update the document(s).

OpInsert

Fields of OpInsert

header: Header

The message header.

flags: OpInsertFlags

A bit vector of insert options.

namespace: String

The full qualified name of the collection, beginning with the database name and a dot separator.

documents: Vec<Document>

The documents to be inserted.

OpQuery

Fields of OpQuery

header: Header

The message header.

flags: OpQueryFlags

A bit vector of query options.

namespace: String

The full qualified name of the collection, beginning with the database name and a dot separator.

number_to_skip: i32

The number of initial documents to skip over in the query results.

number_to_return: i32

The total number of documents that should be returned by the query.

query: Document

Specifies which documents to return.

return_field_selector: Option<Document>

An optional projection of which fields should be present in the documents to be returned by the query.

OpGetMore

Fields of OpGetMore

header: Header

The message header.

namespace: String

The full qualified name of the collection, beginning with the database name and a dot separator.

number_to_return: i32

The total number of documents that should be returned by the query.

cursor_id: i64

Uniquely identifies the cursor being returned.

Methods

impl Message[src]

pub fn new_update(
    request_id: i32,
    namespace: String,
    flags: OpUpdateFlags,
    selector: Document,
    update: Document
) -> Result<Message>
[src]

Constructs a new message for an update.

pub fn new_insert(
    request_id: i32,
    flags: OpInsertFlags,
    namespace: String,
    documents: Vec<Document>
) -> Result<Message>
[src]

Constructs a new message request for an insertion.

pub fn new_query(
    request_id: i32,
    flags: OpQueryFlags,
    namespace: String,
    number_to_skip: i32,
    number_to_return: i32,
    query: Document,
    return_field_selector: Option<Document>
) -> Result<Message>
[src]

Constructs a new message request for a query.

pub fn new_get_more(
    request_id: i32,
    namespace: String,
    number_to_return: i32,
    cursor_id: i64
) -> Message
[src]

Constructs a new "get more" request message.

pub fn write_update<W: Write>(
    buffer: &mut W,
    header: &Header,
    namespace: &str,
    flags: &OpUpdateFlags,
    selector: &Document,
    update: &Document
) -> Result<()>
[src]

Writes a serialized update message to a given buffer.

Arguments

buffer - The buffer to write to. header - The header for the given message. namespace - The full qualified name of the collection, beginning with the database name and a dot. flags - Bit vector of query option. selector - Identifies the document(s) to be updated. update - Instructs how to update the document(s).

Return value

Returns nothing on success, or an Error on failure.

pub fn write_get_more<W: Write>(
    buffer: &mut W,
    header: &Header,
    namespace: &str,
    number_to_return: i32,
    cursor_id: i64
) -> Result<()>
[src]

Writes a serialized "get more" request to a given buffer.

Arguments

buffer - The buffer to write to. header - The header for the given message. namespace - The full qualified name of the collection, beginning with the database name and a dot. number_to_return - The total number of documents that should be returned by the query. cursor_id` - Specifies which cursor to get more documents from.

Return value

Returns nothing on success, or an Error on failure.

pub fn write<W: Write>(&self, buffer: &mut W) -> Result<()>[src]

Attemps to write the serialized message to a buffer.

Arguments

buffer - The buffer to write to.

Return value

Returns nothing on success, or an error string on failure.

pub fn read<T>(buffer: &mut T) -> Result<Message> where
    T: Read + Write
[src]

Attempts to read a serialized reply Message from a buffer.

Arguments

buffer - The buffer to read from.

Return value

Returns the reply message on success, or an Error on failure.

Trait Implementations

impl Clone for Message[src]

impl PartialEq<Message> for Message[src]

impl Debug for Message[src]

Auto Trait Implementations

impl Unpin for Message

impl Sync for Message

impl Send for Message

impl UnwindSafe for Message

impl RefUnwindSafe for Message

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self