FaxResponse

Struct FaxResponse 

Source
pub struct FaxResponse { /* private fields */ }
Expand description

TwiML for Faxes

Implementations§

Source§

impl FaxResponse

Source

pub fn new() -> Self

Create a new FaxResponse

TwiML for Faxes

Examples found in repository?
examples/fax_receive.rs (line 35)
34fn simple_receive() {
35    let response = FaxResponse::new().receive(Some(ReceiveAttributes::new()));
36
37    println!("{}", response.to_xml());
38}
39
40/// Receive fax and store as PDF
41fn receive_as_pdf() {
42    let response = FaxResponse::new().receive(Some(
43        ReceiveAttributes::new()
44            .action("https://example.com/fax-received")
45            .media_type(ReceiveMediaType::ApplicationPdf),
46    ));
47
48    println!("{}", response.to_xml());
49}
50
51/// Receive fax with all configuration options
52fn receive_with_all_options() {
53    let response = FaxResponse::new().receive(Some(
54        ReceiveAttributes::new()
55            .action("https://example.com/fax-received")
56            .method("POST")
57            .media_type(ReceiveMediaType::ApplicationPdf)
58            .page_size(ReceivePageSize::Letter)
59            .store_media(true),
60    ));
61
62    println!("{}", response.to_xml());
63}
64
65/// Receive fax without storing media
66fn receive_no_storage() {
67    let response = FaxResponse::new().receive(Some(
68        ReceiveAttributes::new()
69            .action("https://example.com/fax-metadata")
70            .store_media(false),
71    ));
72
73    println!("{}", response.to_xml());
74}
Source

pub fn receive(self, attributes: Option<ReceiveAttributes>) -> Self

TwiML Verb

§Arguments
  • attributes - TwiML attributes
§Returns

Returns self for method chaining

Examples found in repository?
examples/fax_receive.rs (line 35)
34fn simple_receive() {
35    let response = FaxResponse::new().receive(Some(ReceiveAttributes::new()));
36
37    println!("{}", response.to_xml());
38}
39
40/// Receive fax and store as PDF
41fn receive_as_pdf() {
42    let response = FaxResponse::new().receive(Some(
43        ReceiveAttributes::new()
44            .action("https://example.com/fax-received")
45            .media_type(ReceiveMediaType::ApplicationPdf),
46    ));
47
48    println!("{}", response.to_xml());
49}
50
51/// Receive fax with all configuration options
52fn receive_with_all_options() {
53    let response = FaxResponse::new().receive(Some(
54        ReceiveAttributes::new()
55            .action("https://example.com/fax-received")
56            .method("POST")
57            .media_type(ReceiveMediaType::ApplicationPdf)
58            .page_size(ReceivePageSize::Letter)
59            .store_media(true),
60    ));
61
62    println!("{}", response.to_xml());
63}
64
65/// Receive fax without storing media
66fn receive_no_storage() {
67    let response = FaxResponse::new().receive(Some(
68        ReceiveAttributes::new()
69            .action("https://example.com/fax-metadata")
70            .store_media(false),
71    ));
72
73    println!("{}", response.to_xml());
74}
Source

pub fn comment(self, comment: impl Into<String>) -> Self

Comments in

§Arguments
  • comment - XML Comment
§Returns

Returns self for method chaining

Source

pub fn comment_after(self, comment: impl Into<String>) -> Self

Comments after

§Arguments
  • comment - XML Comment
§Returns

Returns self for method chaining

Source

pub fn comment_before(self, comment: impl Into<String>) -> Self

Comments before

§Arguments
  • comment - XML Comment
§Returns

Returns self for method chaining

Trait Implementations§

Source§

impl Clone for FaxResponse

Source§

fn clone(&self) -> FaxResponse

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FaxResponse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FaxResponse

Source§

fn default() -> FaxResponse

Returns the “default value” for a type. Read more
Source§

impl TwiML for FaxResponse

Source§

fn to_xml(&self) -> String

Convert the TwiML to an XML string
Source§

fn validate(&self) -> Result<Vec<ValidationError>>

Validate the TwiML
Source§

fn validate_strict(&self) -> Result<Vec<ValidationError>>

Validate the TwiML with strict validation

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.