[][src]Enum xz::stream::Action

pub enum Action {

The action argument for process,

After the first use of SyncFlush, FullFlush, FullBarrier, or Finish, the same action' must is used until processreturnsStatus::StreamEnd. Also, the amount of input must not be modified by the application until processreturnsStatus::StreamEnd. Changing the action' or modifying the amount of input will make process return Error::Program.



Continue processing

When encoding, encode as much input as possible. Some internal buffering will probably be done (depends on the filter chain in use), which causes latency: the input used won't usually be decodeable from the output of the same process call.

When decoding, decode as much input as possible and produce as much output as possible.


Make all the input available at output

Normally the encoder introduces some latency. SyncFlush forces all the buffered data to be available at output without resetting the internal state of the encoder. This way it is possible to use compressed stream for example for communication over network.

Only some filters support SyncFlush. Trying to use SyncFlush with filters that don't support it will make process return Error::Options. For example, LZMA1 doesn't support SyncFlush but LZMA2 does.

Using SyncFlush very often can dramatically reduce the compression ratio. With some filters (for example, LZMA2), fine-tuning the compression options may help mitigate this problem significantly (for example, match finder with LZMA2).

Decoders don't support SyncFlush.


Finish encoding of the current block.

All the input data going to the current block must have been given to the encoder. Call process with FullFlush until it returns Status::StreamEnd. Then continue normally with Run or finish the Stream with Finish.

This action is currently supported only by stream encoder and easy encoder (which uses stream encoder). If there is no unfinished block, no empty block is created.


Finish encoding of the current block.

This is like FullFlush except that this doesn't necessarily wait until all the input has been made available via the output buffer. That is, process might return Status::StreamEnd as soon as all the input has been consumed.

FullBarrier is useful with a threaded encoder if one wants to split the .xz Stream into blocks at specific offsets but doesn't care if the output isn't flushed immediately. Using FullBarrier allows keeping the threads busy while FullFlush would make process wait until all the threads have finished until more data could be passed to the encoder.

With a Stream initialized with the single-threaded new_stream_encoder or new_easy_encoder, FullBarrier is an alias for FullFlush.


Finish the current operation

All the input data must have been given to the encoder (the last bytes can still be pending in next_in). Call process with Finish until it returns Status::StreamEnd. Once Finish has been used, the amount of input must no longer be changed by the application.

When decoding, using Finish is optional unless the concatenated flag was used when the decoder was initialized. When concatenated was not used, the only effect of Finish is that the amount of input must not be changed just like in the encoder.

Trait Implementations

impl Clone for Action[src]

impl Copy for Action[src]

Auto Trait Implementations

impl RefUnwindSafe for Action

impl Send for Action

impl Sync for Action

impl Unpin for Action

impl UnwindSafe for Action

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.