pub fn build(self) -> Result<Request<TBody>, RequestError> {
        let method = self.method.ok_or(RequestError::MissingMethod)?;
        let uri = self.uri.ok_or(RequestError::MissingURI)?;
        let body = self.body.ok_or(RequestError::MissingBody)?;

        if self.version != Version::Rtsp2_0 {
            return Err(RequestError::UnsupportedVersion);
        }

        Ok(Request {
            body,
            headers: self.headers,
            method,
            uri,
            version: self.version,
        })
    }
/// Constructs a [`Request`] by consuming all fields set on this builder.
///
/// # Errors
///
/// An error will be returned if part of the request is missing.
///
/// # Examples
///
/// ```
/// use std::convert::TryFrom;
///
/// use rtsp::method::Method;
/// use rtsp::request::Request;
/// use rtsp::uri::request::URI;
///
/// let mut builder = Request::builder();
/// builder
///     .method(Method::Setup)
///     .uri(URI::try_from("rtsp://server.com").unwrap())
///     .body(());
/// let request = builder.build().unwrap();
/// ```
Constructs a [`Request`] by consuming all fields set on this builder.
Constructs a [ ` Request ` ] by consuming all fields set on this builder .
pub fn build(self) -> Result<Request<TBody>, RequestError> {
        let method = self.method.ok_or(RequestError::MissingMethod)?;
        let uri = self.uri.ok_or(RequestError::MissingURI)?;
        let body = self.body.ok_or(RequestError::MissingBody)?;
        if self.version != Version::Rtsp2_0 {
            return Err(RequestError::UnsupportedVersion);
        }
        Ok(Request {
            body,
            headers: self.headers,
            method,
            uri,
            version: self.version,
        })
    }
pub fn build ( self ) -> Result < Request < TBody > , RequestError > { let method = self . method . ok_or ( RequestError :: MissingMethod ) ? ; let uri = self . uri . ok_or ( RequestError :: MissingURI ) ? ; let body = self . body . ok_or ( RequestError :: MissingBody ) ? ; if self . version != Version :: Rtsp2_0 { return Err ( RequestError :: UnsupportedVersion ) ; } Ok ( Request { body , headers : self . headers , method , uri , version : self . version , } ) }
Constructs a [`Request`] by consuming all fields set on this builder.
Constructs a [ ` Request ` ] by consuming all fields set on this builder .
self
self
errors
An error will be returned if part of the request is missing.
An error will be returned if part of the request is missing .
examples
```
use std::convert::TryFrom.

use rtsp::method::Method;
use rtsp::request::Request;
use rtsp::uri::request::URI.

let mut builder = Request::builder();
builder
.method(Method::Setup)
.uri(URI::try_from("rtsp://server.com").unwrap())
.body(());
let request = builder.build().unwrap();
```
` ` ` use std :: convert :: TryFrom . use rtsp :: method :: Method ; use rtsp :: request :: Request ; use rtsp :: uri :: request :: URI . let mut builder = Request :: builder () ; builder . method ( Method :: Setup ) . uri ( URI :: try_from ( " rtsp : // server . com " ) . unwrap () ) . body (( )) ; let request = builder . build () . unwrap () ; ` ` `