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

        if output_size > Self::MAX_LENGTH {
            return Err(Error::OutputTooLong);
        }

        let mut bytes = [0u8; Self::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_LENGTH`] bytes and at most [`Output::MAX_LENGTH`]
/// 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>
    where
        F: FnOnce(&mut [u8]) -> Result<()>,
    {
        if output_size < Self::MIN_LENGTH {
            return Err(Error::OutputTooShort);
        }
        if output_size > Self::MAX_LENGTH {
            return Err(Error::OutputTooLong);
        }
        let mut bytes = [0u8; Self::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 > where F : FnOnce ( & mut [ u8 ] ) -> Result < ( ) > , { if output_size < Self :: MIN_LENGTH { return Err ( Error :: OutputTooShort ) ; } if output_size > Self :: MAX_LENGTH { return Err ( Error :: OutputTooLong ) ; } let mut bytes = [ 0u8 ; Self :: 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