Struct chronicle::queue::Wire

#[repr(C)]
pub struct Wire { /* private fields */ }
Expand description

Wire is a Chronicle abstraction over binary resources such as Queue. There are two access patterns depending on user preferences:

  • read/write via the ValueIn and ValueOut abstractions
  • direct interaction with the underlying bytes::Bytes

Data written to a Wire can optionally have an associated field name, which enables content to be read and written in a flexible format supporting optional fields and/or arbitrary field order.

Example

// writer places three items onto the `Wire`
wire.write("one").int32(1)
    .write("two").int32(2)
    .write("three").int32(3);

// reader reads only the content it is interested in, in arbitrary order
let three = wire.read("three").int32();
let one = wire.read("one").int32();

assert!(one == 1);
assert!(three == 3);

Implementations§

Get a handle to this Wire’s ValueOut for writing data to the underlying Queue

See ValueOut for more details

Write the given field name to the Wire. Returns the associated ValueOut (supports chaining)

Example
wire.write("key").string("value");

Get a handle to this Wire’s ValueIn for reading data from the underlying Queue See ValueIn for more details

Read the given field name from the Wire. Returns the associated ValueOut (supports chaining)

Example
let data = wire.read("key").string();

Get a handle to the message Bytes for this Wire

Data can then be read or written (depending on the context in which the Wire is used) using the methods described in Bytes

Example
let context = appender.writing_document();
let bytes = context.wire().bytes();
bytes.write_string("incomplete longer write");

Trait Implementations§

§

type Id

A type-level representation of the type’s C++ namespace and type name. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.