pub fn from_parts(
        version: Version,
        status_code: StatusCode,
        reason_phrase: ReasonPhrase,
        headers: HeaderMap,
        body: TBody,
    ) -> Result<Self, ResponseError> {
        let mut builder = Response::<()>::builder()
            .with_version(version)
            .with_status_code(status_code)
            .with_reason_phrase(Some(reason_phrase))
            .with_body(body);
        builder.headers = headers;
        builder.build()
    }
/// Constructs a response from its individual parts.
///
/// # Errors
///
/// An error will be returned if the combination of parts creates an invalid response.
///
/// # Examples
///
/// ```
/// use std::convert::TryFrom;
/// use std::iter::FromIterator;
///
/// use rtsp::header::map::HeaderMap;
/// use rtsp::header::name::HeaderName;
/// use rtsp::header::value::HeaderValue;
/// use rtsp::response::Response;
/// use rtsp::status::StatusCode;
/// use rtsp::version::Version;
///
/// let response = Response::from_parts(
///     Version::Rtsp2_0,
///     StatusCode::OK,
///     StatusCode::OK.canonical_reason().unwrap(),
///     HeaderMap::from_iter(vec![
///         (HeaderName::ContentLength, HeaderValue::try_from("0").unwrap())
///     ]),
///     "",
/// ).unwrap();
/// assert_eq!(response.version(), Version::Rtsp2_0);
/// assert_eq!(response.status_code(), StatusCode::OK);
/// assert_eq!(response.reason_phrase(), &StatusCode::OK.canonical_reason().unwrap());
/// assert_eq!(
///     response.headers().get(&HeaderName::ContentLength),
///     Some(&HeaderValue::try_from("0").unwrap())
/// );
/// assert_eq!(response.body(), &"");
/// ```
Constructs a response from its individual parts.
Constructs a response from its individual parts .
pub fn from_parts(
        version: Version,
        status_code: StatusCode,
        reason_phrase: ReasonPhrase,
        headers: HeaderMap,
        body: TBody,
    ) -> Result<Self, ResponseError> {
        let mut builder = Response::<()>::builder()
            .with_version(version)
            .with_status_code(status_code)
            .with_reason_phrase(Some(reason_phrase))
            .with_body(body);
        builder.headers = headers;
        builder.build()
    }
pub fn from_parts ( version : Version , status_code : StatusCode , reason_phrase : ReasonPhrase , headers : HeaderMap , body : TBody , ) -> Result < Self , ResponseError > { let mut builder = Response :: < ( ) > :: builder ( ) . with_version ( version ) . with_status_code ( status_code ) . with_reason_phrase ( Some ( reason_phrase ) ) . with_body ( body ) ; builder . headers = headers ; builder . build ( ) }
Constructs a response from its individual parts.
Constructs a response from its individual parts .
version
Version
status_code
StatusCode
reason_phrase
ReasonPhrase
headers
HeaderMap
body
TBody
version
Version
status_code
StatusCode
reason_phrase
ReasonPhrase
headers
HeaderMap
body
TBody
errors
An error will be returned if the combination of parts creates an invalid response.
An error will be returned if the combination of parts creates an invalid response .
examples
```
use std::convert::TryFrom;
use std::iter::FromIterator.

use rtsp::header::map::HeaderMap;
use rtsp::header::name::HeaderName;
use rtsp::header::value::HeaderValue;
use rtsp::response::Response;
use rtsp::status::StatusCode;
use rtsp::version::Version.

let response = Response::from_parts(
Version::Rtsp2_0,
StatusCode::OK,
StatusCode::OK.canonical_reason().unwrap(),
HeaderMap::from_iter(vec![
(HeaderName::ContentLength, HeaderValue::try_from("0").unwrap())
]),
"",
).unwrap();
assert_eq!(response.version(), Version::Rtsp2_0);
assert_eq!(response.status_code(), StatusCode::OK);
assert_eq!(response.reason_phrase(), &StatusCode::OK.canonical_reason().unwrap());
assert_eq!(
response.headers().get(&HeaderName::ContentLength),
Some(&HeaderValue::try_from("0").unwrap())
);
assert_eq!(response.body(), &"");
```
` ` ` use std :: convert :: TryFrom ; use std :: iter :: FromIterator . use rtsp :: header :: map :: HeaderMap ; use rtsp :: header :: name :: HeaderName ; use rtsp :: header :: value :: HeaderValue ; use rtsp :: response :: Response ; use rtsp :: status :: StatusCode ; use rtsp :: version :: Version . let response = Response :: from_parts ( Version :: Rtsp2_0 StatusCode :: OK StatusCode :: OK . canonical_reason () . unwrap () HeaderMap :: from_iter ( vec! [ ( HeaderName :: ContentLength HeaderValue :: try_from ( " 0 " ) . unwrap () ) ] ) " " ) . unwrap () ; assert_eq! ( response . version () Version :: Rtsp2_0 ) ; assert_eq! ( response . status_code () StatusCode :: OK ) ; assert_eq! ( response . reason_phrase () &StatusCode :: OK . canonical_reason () . unwrap () ) ; assert_eq! ( response . headers () . get ( &HeaderName :: ContentLength ) Some ( &HeaderValue :: try_from ( " 0 " ) . unwrap () ) ) ; assert_eq! ( response . body () & " " ) ; ` ` `