fn decode<'header, Iter>(values: &mut Iter) -> Result<Option<Self>, Self::DecodeError>
    where
        Iter: Iterator<Item = &'header HeaderValue>,
    {
        let value = match values.next() {
            Some(value) => value,
            None => return Ok(None),
        };

        if values.next().is_some() {
            return Err(ContentLengthError::MoreThanOneHeader);
        }

        let content_length = value
            .as_str()
            .parse::<usize>()
            .map_err(|error| ContentLengthError::try_from(error.kind().clone()).unwrap())?;
        ContentLength::try_from(content_length).map(Some)
    }
/// Converts the raw header values to the [`ContentLength`] header type. Based on the syntax
/// provided by [RFC7826](https://tools.ietf.org/html/rfc7826#section-20), this header has the
/// following syntax:
///
/// ```text
/// DIGIT = %x30-39 ; any US-ASCII digit "0".."9"
/// CR = %x0D ; US-ASCII CR, carriage return (13)
/// LF = %x0A  ; US-ASCII LF, linefeed (10)
/// SP = %x20  ; US-ASCII SP, space (32)
/// HT = %x09  ; US-ASCII HT, horizontal-tab (9)
/// CRLF = CR LF
/// LWS = [CRLF] 1*( SP / HT ) ; Line-breaking whitespace
/// SWS = [LWS] ; Separating whitespace
/// HCOLON = *( SP / HT ) ":" SWS
/// Content-Length = "Content-Length" HCOLON 1*19DIGIT
/// ```
///
/// However, in order to allow 19 digits to be used, 64 bit integers need to be used
/// (i.e. [`u64`]), but the length of the buffer during decoding is of type [`usize`], so the
/// actual allowed length may be significantly smaller depending on the architecture.
///
/// The absence of a header value defaults the content length to a value of zero.
///
/// # Examples
///
/// ```
/// use std::convert::TryFrom;
///
/// use rtsp::header::map::TypedHeader;
/// use rtsp::header::types::ContentLength;
/// use rtsp::header::value::HeaderValue;
///
/// let raw_header: Vec<HeaderValue> = vec![];
/// assert_eq!(ContentLength::decode(&mut raw_header.iter()).unwrap(), None);
///
/// let typed_header = ContentLength::try_from(10).unwrap();
/// let raw_header = vec![HeaderValue::try_from("10").unwrap()];
/// assert_eq!(ContentLength::decode(&mut raw_header.iter()).unwrap(), Some(typed_header));
///
/// let raw_header = vec![HeaderValue::try_from("invalid content length").unwrap()];
/// assert!(ContentLength::decode(&mut raw_header.iter()).is_err());
/// ```
Converts the raw header values to the [`ContentLength`] header type. Based on the syntax
provided by [RFC7826], this header has the
following syntax.



However, in order to allow 19 digits to be used, 64 bit integers need to be used
, but the length of the buffer during decoding is of type [`usize`], so the
actual allowed length may be significantly smaller depending on the architecture.

The absence of a header value defaults the content length to a value of zero.
Converts the raw header values to the [ ` ContentLength ` ] header type . Based on the syntax provided by [ RFC7826 ] this header has the following syntax . However in order to allow 19 digits to be used 64 bit integers need to be used but the length of the buffer during decoding is of type [ ` usize ` ] so the actual allowed length may be significantly smaller depending on the architecture . The absence of a header value defaults the content length to a value of zero .
fn decode<'header, Iter>(values: &mut Iter) -> Result<Option<Self>, Self::DecodeError>
    where
        Iter: Iterator<Item = &'header HeaderValue>,
    {
        let value = match values.next() {
            Some(value) => value,
            None => return Ok(None),
        };
        if values.next().is_some() {
            return Err(ContentLengthError::MoreThanOneHeader);
        }
        let content_length = value
            .as_str()
            .parse::<usize>()
            .map_err(|error| ContentLengthError::try_from(error.kind().clone()).unwrap())?;
        ContentLength::try_from(content_length).map(Some)
    }
fn decode < ' header , Iter > ( values : & mut Iter ) -> Result < Option < Self > , Self :: DecodeError > where Iter : Iterator < Item = & ' header HeaderValue > , { let value = match values . next ( ) { Some ( value ) => value , None => return Ok ( None ) , } ; if values . next ( ) . is_some ( ) { return Err ( ContentLengthError :: MoreThanOneHeader ) ; } let content_length = value . as_str ( ) . parse :: < usize > ( ) . map_err ( | error | ContentLengthError :: try_from ( error . kind ( ) . clone ( ) ) . unwrap ( ) ) ? ; ContentLength :: try_from ( content_length ) . map ( Some ) }
Converts the raw header values to the [`ContentLength`] header type.
Converts the raw header values to the [ ` ContentLength ` ] header type .
values
&mut Iter
values
&mut Iter
examples
```
use std::convert::TryFrom.

use rtsp::header::map::TypedHeader;
use rtsp::header::types::ContentLength;
use rtsp::header::value::HeaderValue.

let raw_header: Vec = vec![];
assert_eq!(ContentLength::decode(&mut raw_header.iter()).unwrap(), None).

let typed_header = ContentLength::try_from(10).unwrap();
let raw_header = vec![HeaderValue::try_from("10").unwrap()];
assert_eq!(ContentLength::decode(&mut raw_header.iter()).unwrap(), Some(typed_header)).

let raw_header = vec![HeaderValue::try_from("invalid content length").unwrap()];
assert!(ContentLength::decode(&mut raw_header.iter()).is_err());
```
` ` ` use std :: convert :: TryFrom . use rtsp :: header :: map :: TypedHeader ; use rtsp :: header :: types :: ContentLength ; use rtsp :: header :: value :: HeaderValue . let raw_header : Vec = vec! [] ; assert_eq! ( ContentLength :: decode ( &mut raw_header . iter () ) . unwrap () None ) . let typed_header = ContentLength :: try_from ( 10 ) . unwrap () ; let raw_header = vec! [ HeaderValue :: try_from ( " 10 " ) . unwrap () ] ; assert_eq! ( ContentLength :: decode ( &mut raw_header . iter () ) . unwrap () Some ( typed_header )) . let raw_header = vec! [ HeaderValue :: try_from ( " invalid content length " ) . unwrap () ] ; assert! ( ContentLength :: decode ( &mut raw_header . iter () ) . is_err () ) ; ` ` `