pub fn init_with<F>(output_size: usize, f: F) -> Result<Self, OutputError>
    where
        F: FnOnce(&mut [u8]) -> Result<(), OutputError>,
    {
        if output_size < Self::min_len() {
            return Err(OutputError::TooShort);
        }

        if output_size > Self::max_len() {
            return Err(OutputError::TooLong);
        }

        let mut bytes = [0u8; MAX_LENGTH];
        f(&mut bytes[..output_size])?;

        Ok(Self {
            bytes,
            length: output_size as u8,
            encoding: Encoding::default(),
        })
    }
/// Initialize an [`Output`] using the provided method, which is given
/// a mutable byte slice into which it should write the output.
///
/// The `output_size` (in bytes) must be known in advance, as well as at
/// least [`Output::min_len`] bytes and at most [`Output::max_len`] bytes.
Initialize an [`Output`] using the provided method, which is given
a mutable byte slice into which it should write the output.


Initialize an [ ` Output ` ] using the provided method which is given a mutable byte slice into which it should write the output .
pub fn init_with<F>(output_size: usize, f: F) -> Result<Self, OutputError>
    where
        F: FnOnce(&mut [u8]) -> Result<(), OutputError>,
    {
        if output_size < Self::min_len() {
            return Err(OutputError::TooShort);
        }
        if output_size > Self::max_len() {
            return Err(OutputError::TooLong);
        }
        let mut bytes = [0u8; MAX_LENGTH];
        f(&mut bytes[..output_size])?;
        Ok(Self {
            bytes,
            length: output_size as u8,
            encoding: Encoding::default(),
        })
    }
pub fn init_with < F > ( output_size : usize , f : F ) -> Result < Self , OutputError > where F : FnOnce ( & mut [ u8 ] ) -> Result < ( ) , OutputError > , { if output_size < Self :: min_len ( ) { return Err ( OutputError :: TooShort ) ; } if output_size > Self :: max_len ( ) { return Err ( OutputError :: TooLong ) ; } let mut bytes = [ 0u8 ; MAX_LENGTH ] ; f ( & mut bytes [ .. output_size ] ) ? ; Ok ( Self { bytes , length : output_size as u8 , encoding : Encoding :: default ( ) , } ) }
Initialize an [`Output`] using the provided method, which is given
a mutable byte slice into which it should write the output.
Initialize an [ ` Output ` ] using the provided method which is given a mutable byte slice into which it should write the output .
output_size
usize
f
F
output_size
usize
f
F