[][src]Trait glk::helpers::stream::Stream

pub trait Stream {
    fn close(&mut self) -> Option<stream_result_t>;
fn get_rock(&self) -> u32;
fn set_position(&mut self, pos: i32, mode: seekmode);
fn get_position(&mut self) -> u32;
fn put_buffer(&mut self, buf: &[u8]) -> strid_t;
fn put_buffer_uni(&mut self, buf: &[u32]) -> strid_t;
fn set_style(&mut self, styl: Style) -> strid_t;
fn get_buffer(&mut self, buf: &mut [u8]) -> u32;
fn get_buffer_uni(&mut self, buf: &mut [u32]) -> u32;
fn set_di_rock(&mut self, girock: rock);
fn get_di_rock(&self) -> rock; }

Base trait for stream handling.

Required methods

fn close(&mut self) -> Option<stream_result_t>

This function is called before closing the stream. It returns

  • the current stream counters, or None if the stream may not be closed.
  • @note associated Glk function is glk_stream_close.

fn get_rock(&self) -> u32

Gets the rock for the stream. This is an arbitrary u32 that

  • was provided on creation.
  • @note associated Glk function is glk_stream_get_rock.

fn set_position(&mut self, pos: i32, mode: seekmode)

Set current position for reading/writing in the stream.

  • @note associated Glk function is glk_stream_set_position.

fn get_position(&mut self) -> u32

Get current position for reading/writing in the stream.

  • @note associated Glk function is glk_stream_get_position.

fn put_buffer(&mut self, buf: &[u8]) -> strid_t

Write to the stream. Optionally returns a stream id to mirror to.

  • @note associated Glk functions are:
    • glk_put_char
    • glk_put_char_stream
    • glk_put_buffer
    • glk_put_buffer_stream
    • glk_put_string
    • glk_put_string_stream
  • These are all specific cases of writing a buffer to the stream.

fn put_buffer_uni(&mut self, buf: &[u32]) -> strid_t

Write unicode code points to the stream. Optionally returns a stream id to mirror to.

  • @note associated Glk functions are:
    • glk_put_char_uni
    • glk_put_char_stream_uni
    • glk_put_buffer_uni
    • glk_put_buffer_stream_uni
    • glk_put_string_uni
    • glk_put_string_stream_uni
  • These are all specific cases of writing a unicode buffer to the stream.

fn set_style(&mut self, styl: Style) -> strid_t

Set current style. Streams that don't have a concept of style can

  • simply ignore this. Optionally returns a stream id to mirror to.
  • @note Associated Glk functions are:
    • glk_set_style
    • glk_set_style_stream
    • glk_set_hyperlink (TODO)
    • glk_set_hyperlink_stream (TODO)
    • garglk_set_zcolors
    • garglk_set_zcolors_stream
    • garglk_set_reversevideo
    • garglk_set_reversevideo_stream

fn get_buffer(&mut self, buf: &mut [u8]) -> u32

Read from the stream.

  • @note Associated Glk functions are:
    • glk_get_buffer
    • glk_get_char

fn get_buffer_uni(&mut self, buf: &mut [u32]) -> u32

Read unicode code points from the stream.

  • @note Associated Glk functions are:
    • glk_get_buffer_uni
    • glk_get_char_uni

fn set_di_rock(&mut self, girock: rock)

Set dispatch rock. This is an arbitrary value stored by the Glk client in the stream

  • object.
  • @note There are no associated Glk functions.
  • This is internal to the gidispatch system used to dispatch Glk functions from a VM.

fn get_di_rock(&self) -> rock

Get dispatch rock.

  • @note There are no associated Glk functions.
  • This is internal to the gidispatch system used to dispatch Glk functions from a VM.
Loading content...

Implementors

impl Stream for FileStreamBin32[src]

impl Stream for FileStreamBin8[src]

impl Stream for FileStreamUTF8[src]

impl Stream for MemoryStream32[src]

impl Stream for MemoryStream8[src]

impl Stream for WindowStream[src]

Loading content...