Struct futures_glib::IoChannel
[−]
[src]
pub struct IoChannel { /* fields omitted */ }
Wrapper around the underlying glib GIOChannel
type
Methods
impl IoChannel
[src]
pub unsafe fn unix_new(fd: RawFd) -> Self
[src]
pub fn buffer_size(&self) -> usize
[src]
Gets the internal buffer size.
pub fn set_buffer_size(&self, size: usize)
[src]
Sets the buffer size.
If 0, then glib will pick a good size.
pub fn is_buffered(&self) -> bool
[src]
Returns whether this channel is buffered.
pub fn set_buffered(&self, buffered: bool)
[src]
Sets whether this channel is buffered or not.
The buffering state can only be set if the channel's encoding is null. For any other encoding, the channel must be buffered.
A buffered channel can only be set unbuffered if the channel's internal
buffers have been flushed. Newly created channels or channels which
have returned G_IO_STATUS_EOF
don't require such a flush. For
write-only channels, a call to `flush is sufficient. Note that this
means that socket-based channels cannot be set unbuffered once they
have had data read from them.
The default state of the channel is buffered.
pub fn is_close_on_drop(&self) -> bool
[src]
Returns whether the file/socket/whatever associated with channel will be closed when channel receives its final unref and is destroyed.
The default value of this is true for channels created by
g_io_channel_new_file()
, and false for all other channels.
pub fn set_close_on_drop(&self, close: bool)
[src]
Sets whether this channel will close the underlying I/O object whent he last reference goes out of scope.
Setting this flag to true for a channel you have already closed can cause problems.
pub fn close(&self, flush: bool) -> Result<()>
[src]
Close an IO channel.
Any pending data to be written will be flushed if flush is true
. The
channel will not be freed until the last reference is dropped.
pub fn create_watch(&self, condition: &IoCondition) -> Source<IoChannelFuncs>
[src]
Creates a Source
that's dispatched when condition is met for the given
channel. For example, if condition is G_IO_IN
, the source will be
dispatched when there's data available for reading.
On Windows, polling a Source
created to watch a channel for a socket
puts the socket in non-blocking mode. This is a side-effect of the
implementation and unavoidable.
pub fn encoding(&self) -> Option<&str>
[src]
Gets the encoding for the input/output of the channel.
The internal encoding is always UTF-8. The encoding None
makes the
channel safe for binary data.
pub fn set_encoding(&self, encoding: Option<&str>) -> Result<()>
[src]
Sets the encoding for the input/output of the channel. The internal encoding is always UTF-8. The default encoding for the external file is UTF-8.
The encoding None
is safe to use with binary data.
Trait Implementations
impl AsRawFd for IoChannel
[src]
impl Read for IoChannel
[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
[src]
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
unsafe fn initializer(&self) -> Initializer
[src]
read_initializer
)Determines if this Read
er can work with buffers of uninitialized memory. Read more
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
1.0.0[src]
Read all bytes until EOF in this source, placing them into buf
. Read more
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
1.0.0[src]
Read all bytes until EOF in this source, appending them to buf
. Read more
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
1.6.0[src]
Read the exact number of bytes required to fill buf
. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Creates a "by reference" adaptor for this instance of Read
. Read more
fn bytes(self) -> Bytes<Self>
1.0.0[src]
Transforms this Read
instance to an [Iterator
] over its bytes. Read more
fn chars(self) -> Chars<Self>
[src]
🔬 This is a nightly-only experimental API. (io
)
the semantics of a partial read/write of where errors happen is currently unclear and may change
Transforms this Read
instance to an [Iterator
] over [char
]s. Read more
fn chain<R>(self, next: R) -> Chain<Self, R> where
R: Read,
1.0.0[src]
R: Read,
Creates an adaptor which will chain this stream with another. Read more
fn take(self, limit: u64) -> Take<Self>
1.0.0[src]
Creates an adaptor which will read at most limit
bytes from it. Read more
impl<'a> Read for &'a IoChannel
[src]
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
[src]
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
unsafe fn initializer(&self) -> Initializer
[src]
read_initializer
)Determines if this Read
er can work with buffers of uninitialized memory. Read more
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
1.0.0[src]
Read all bytes until EOF in this source, placing them into buf
. Read more
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
1.0.0[src]
Read all bytes until EOF in this source, appending them to buf
. Read more
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
1.6.0[src]
Read the exact number of bytes required to fill buf
. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Creates a "by reference" adaptor for this instance of Read
. Read more
fn bytes(self) -> Bytes<Self>
1.0.0[src]
Transforms this Read
instance to an [Iterator
] over its bytes. Read more
fn chars(self) -> Chars<Self>
[src]
🔬 This is a nightly-only experimental API. (io
)
the semantics of a partial read/write of where errors happen is currently unclear and may change
Transforms this Read
instance to an [Iterator
] over [char
]s. Read more
fn chain<R>(self, next: R) -> Chain<Self, R> where
R: Read,
1.0.0[src]
R: Read,
Creates an adaptor which will chain this stream with another. Read more
fn take(self, limit: u64) -> Take<Self>
1.0.0[src]
Creates an adaptor which will read at most limit
bytes from it. Read more
impl Write for IoChannel
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
[src]
Write a buffer into this object, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>
[src]
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Creates a "by reference" adaptor for this instance of Write
. Read more
impl<'a> Write for &'a IoChannel
[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>
[src]
Write a buffer into this object, returning how many bytes were written. Read more
fn flush(&mut self) -> Result<()>
[src]
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0[src]
Attempts to write an entire buffer into this write. Read more
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0[src]
Writes a formatted string into this writer, returning any error encountered. Read more
fn by_ref(&mut self) -> &mut Self
1.0.0[src]
Creates a "by reference" adaptor for this instance of Write
. Read more
impl From<TcpStream> for IoChannel
[src]
ⓘImportant traits for IoChannelfn from(socket: TcpStream) -> IoChannel
[src]
Performs the conversion.
impl Clone for IoChannel
[src]
ⓘImportant traits for IoChannelfn clone(&self) -> IoChannel
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more