Enum jaded::Content

source ·
pub enum Content {
    Object(Value),
    Block(Vec<u8>),
}
Expand description

The content read from a stream.

Either an object or raw primitive data. Also used to represent class and object annotations for custom write methods

This is the top level type that clients will interact with. When Java code writes to a stream it can choose to write

  • objects, which will each be read into an instance of Object (containing its data)

  • primitives, which are written as bytes and returned as instances of Block (containing the data).

    The individual java primitives are not distinguished in the stream so that writing (short)1 twice and writing (int)65537 once result in the same stream being wrtten. For this reason, decoding the bytes read is left to the client code that hopefully knows what format to expect.

Variants§

§

Object(Value)

A deserialized Java Object

§

Block(Vec<u8>)

An array of raw data

Implementations§

Get the value of the object represented by this instance

panics if this Content is raw block data

Get the raw block data represented by this instance

panics is this Content is an object value

Trait Implementations§

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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.