pub trait Encoder<E>: Capacitywhere
E: Context,{
// Required method
fn partial_encode(
&self,
context: &mut E,
data: &mut dyn Iterator<Item = Bit>,
) -> Result<EncoderResult, Box<dyn Error>>;
// Provided method
fn encode(
&self,
context: &mut E,
data: &mut dyn Iterator<Item = Bit>,
progress_channel: Option<&Sender<ProgressStatus>>,
) -> Result<String, Box<dyn Error>> { ... }
}
Expand description
Base trait for all data encoders. The generic type should contain data need by the encoder implementation.
Required Methods§
Sourcefn partial_encode(
&self,
context: &mut E,
data: &mut dyn Iterator<Item = Bit>,
) -> Result<EncoderResult, Box<dyn Error>>
fn partial_encode( &self, context: &mut E, data: &mut dyn Iterator<Item = Bit>, ) -> Result<EncoderResult, Box<dyn Error>>
Encodes bits provided by data
iterator.
Every Encoder has Context which exposes access to cover text. See Context for more info.
§Arguments
context
- context of the steganography method, can contain various needed info like pivot etc.data
- data iterator which return Bit with each iteration
§Returns
It returns whether the encoding was successful. See EncoderResult and EncodingError.