pub struct DecodedInt { /* private fields */ }
Expand description
Represents a fixed-length signed integer. See the UInt and Int Fields section of the binary Ion spec for more details.
Implementations§
Source§impl DecodedInt
impl DecodedInt
Sourcepub fn read<R: IonDataSource>(
data_source: &mut R,
length: usize,
) -> IonResult<DecodedInt>
pub fn read<R: IonDataSource>( data_source: &mut R, length: usize, ) -> IonResult<DecodedInt>
Reads an Int with length
bytes from the provided data source.
pub fn read_using_buffer<R: IonDataSource>( data_source: &mut R, length: usize, buffer: &mut [u8], ) -> IonResult<DecodedInt>
Sourcepub fn write_i64<W: Write>(sink: &mut W, value: i64) -> IonResult<usize>
pub fn write_i64<W: Write>(sink: &mut W, value: i64) -> IonResult<usize>
Encodes the provided value
as an Int and writes it to the provided sink
.
Returns the number of bytes written.
Sourcepub fn write_negative_zero<W: Write>(sink: &mut W) -> IonResult<usize>
pub fn write_negative_zero<W: Write>(sink: &mut W) -> IonResult<usize>
Encodes a negative zero as an Int
and writes it to the privided sink
.
Returns the number of bytes written.
This method is similar to Self::write_i64. However, because an i64 cannot represent a negative zero, a separate method is required.
Sourcepub fn is_negative_zero(&self) -> bool
pub fn is_negative_zero(&self) -> bool
Returns true
if the Int is negative zero.
Sourcepub fn size_in_bytes(&self) -> usize
pub fn size_in_bytes(&self) -> usize
Returns the number of bytes that were read from the data source to construct this signed integer.
Trait Implementations§
Source§impl Debug for DecodedInt
impl Debug for DecodedInt
Source§impl From<DecodedInt> for Coefficient
impl From<DecodedInt> for Coefficient
Source§fn from(int: DecodedInt) -> Self
fn from(int: DecodedInt) -> Self
Source§impl From<DecodedInt> for Int
impl From<DecodedInt> for Int
Source§fn from(uint: DecodedInt) -> Self
fn from(uint: DecodedInt) -> Self
Note that if the DecodedInt represents -0, converting it to an Integer will result in a 0. If negative zero is significant to your use case, check it using DecodedInt::is_negative_zero before converting it to an Integer.