gio::prelude

Trait DataInputStreamExt

Source
pub trait DataInputStreamExt:
    IsA<DataInputStream>
    + Sealed
    + 'static {
Show 13 methods // Provided methods fn byte_order(&self) -> DataStreamByteOrder { ... } fn newline_type(&self) -> DataStreamNewlineType { ... } fn read_byte( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<u8, Error> { ... } fn read_int16( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<i16, Error> { ... } fn read_int32( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<i32, Error> { ... } fn read_int64( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<i64, Error> { ... } fn read_uint16( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<u16, Error> { ... } fn read_uint32( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<u32, Error> { ... } fn read_uint64( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<u64, Error> { ... } fn set_byte_order(&self, order: DataStreamByteOrder) { ... } fn set_newline_type(&self, type_: DataStreamNewlineType) { ... } fn connect_byte_order_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_newline_type_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all DataInputStream methods.

§Implementors

DataInputStream

Provided Methods§

Source

fn byte_order(&self) -> DataStreamByteOrder

Gets the byte order for the data input stream.

§Returns

the @self’s current #GDataStreamByteOrder.

Source

fn newline_type(&self) -> DataStreamNewlineType

Gets the current newline type for the @self.

§Returns

#GDataStreamNewlineType for the given @self.

Source

fn read_byte( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<u8, Error>

Reads an unsigned 8-bit/1-byte value from @self.

§cancellable

optional #GCancellable object, None to ignore.

§Returns

an unsigned 8-bit/1-byte value read from the @self or 0 if an error occurred.

Source

fn read_int16( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<i16, Error>

Reads a 16-bit/2-byte value from @self.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

§cancellable

optional #GCancellable object, None to ignore.

§Returns

a signed 16-bit/2-byte value read from @self or 0 if an error occurred.

Source

fn read_int32( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<i32, Error>

Reads a signed 32-bit/4-byte value from @self.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

If @cancellable is not None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IOErrorEnum::Cancelled will be returned.

§cancellable

optional #GCancellable object, None to ignore.

§Returns

a signed 32-bit/4-byte value read from the @self or 0 if an error occurred.

Source

fn read_int64( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<i64, Error>

Reads a 64-bit/8-byte value from @self.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

If @cancellable is not None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IOErrorEnum::Cancelled will be returned.

§cancellable

optional #GCancellable object, None to ignore.

§Returns

a signed 64-bit/8-byte value read from @self or 0 if an error occurred.

Source

fn read_uint16( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<u16, Error>

Reads an unsigned 16-bit/2-byte value from @self.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

§cancellable

optional #GCancellable object, None to ignore.

§Returns

an unsigned 16-bit/2-byte value read from the @self or 0 if an error occurred.

Source

fn read_uint32( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<u32, Error>

Reads an unsigned 32-bit/4-byte value from @self.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().

If @cancellable is not None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IOErrorEnum::Cancelled will be returned.

§cancellable

optional #GCancellable object, None to ignore.

§Returns

an unsigned 32-bit/4-byte value read from the @self or 0 if an error occurred.

Source

fn read_uint64( &self, cancellable: Option<&impl IsA<Cancellable>>, ) -> Result<u64, Error>

Reads an unsigned 64-bit/8-byte value from @self.

In order to get the correct byte order for this read operation, see g_data_input_stream_get_byte_order().

If @cancellable is not None, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error IOErrorEnum::Cancelled will be returned.

§cancellable

optional #GCancellable object, None to ignore.

§Returns

an unsigned 64-bit/8-byte read from @self or 0 if an error occurred.

Source

fn set_byte_order(&self, order: DataStreamByteOrder)

This function sets the byte order for the given @self. All subsequent reads from the @self will be read in the given @order.

§order

a #GDataStreamByteOrder to set.

Source

fn set_newline_type(&self, type_: DataStreamNewlineType)

Sets the newline type for the @self.

Note that using G_DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a read chunk ends in “CR” we must read an additional byte to know if this is “CR” or “CR LF”, and this might block if there is no more data available.

§type_

the type of new line return as #GDataStreamNewlineType.

Source

fn connect_byte_order_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Source

fn connect_newline_type_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§