pub fn write_all<ErrType, W>(writer: &mut W, buf: &[u8]) -> Result<(), ErrType> where
    W: CustomWrite<ErrType>,