Struct bcder::int::Integer[][src]

pub struct Integer(_);
Expand description

A BER encoded integer.

As integers are variable length in BER, this type is just a simple wrapper atop the underlying Bytes value containing the raw content. A value of this type is a signed integer. If a value is defined as an unsigned integer, i.e., as INTEGER (0..MAX), you should use the sibling type Unsigned instead.

In addition to these two generic types, the content decoders also provide methods to parse integers into native integer types such as i8. If the range of such a type is obviously enough, you might want to consider using these methods instead.

BER Encoding

In BER, an INTEGER is encoded as a primitive value with the content octets providing a variable-length, big-endian, two‘s complement byte sequence of that integer. Thus, the most-significant bit of the first octet serves as the sign bit.

Implementations

Takes a single signed integer from the beginning of an encoded value.

This requires the next value in cons to be a primitive value with a correctly encoded signed integer.

Constructs a signed integer from the content of a primitive value.

Constructs an i8 from the content of a primitive value.

Constructs an i16 from the content of a primitive value.

Constructs an i32 from the content of a primitive value.

Constructs an i64 from the content of a primitive value.

Constructs an i128 from the content of a primitive value.

Trades the integer into a bytes value with the raw content octets.

Returns a bytes slice with the raw content.

Returns whether the number is zero.

Returns whether the integer is positive.

Also returns false if the number is zero.

Returns whether the integer is negative.

Also returns false if the number is zero.

Trait Implementations

Performs the conversion.

Performs the conversion.

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

The natural tag of an encoded value of this type.

Returns the length of the encoded content of this type.

Writes the encoded content to a writer.

Encodes the value to bytes (useful when you need to sign a structure)

Returns a value encoder for this content using the natural tag. Read more

Returns a value encoder for this content using the given tag. Read more

Returns a value encoder for a reference using the natural tag.

Returns a value encoder for a reference using the given tag.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.