ReceiveAttributes

Struct ReceiveAttributes 

Source
pub struct ReceiveAttributes {
    pub action: Option<String>,
    pub media_type: Option<ReceiveMediaType>,
    pub method: Option<String>,
    pub page_size: Option<ReceivePageSize>,
    pub store_media: Option<bool>,
}
Expand description

Attributes to pass to receive

Fields§

§action: Option<String>

action - Receive action URL

§media_type: Option<ReceiveMediaType>

mediaType - The media type used to store media in the fax media store

§method: Option<String>

method - Receive action URL method

§page_size: Option<ReceivePageSize>

pageSize - What size to interpret received pages as

§store_media: Option<bool>

storeMedia - Whether or not to store received media in the fax media store

Implementations§

Source§

impl ReceiveAttributes

Source

pub fn new() -> Self

Create a new ReceiveAttributes

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 action(self, action: impl Into<String>) -> Self

Set the action URL

Examples found in repository?
examples/fax_receive.rs (line 44)
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 media_type(self, media_type: ReceiveMediaType) -> Self

Set the media type

Examples found in repository?
examples/fax_receive.rs (line 45)
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}
Source

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

Set the HTTP method

Examples found in repository?
examples/fax_receive.rs (line 56)
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}
Source

pub fn page_size(self, page_size: ReceivePageSize) -> Self

Set the page size

Examples found in repository?
examples/fax_receive.rs (line 58)
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}
Source

pub fn store_media(self, store_media: bool) -> Self

Set whether to store media

Examples found in repository?
examples/fax_receive.rs (line 59)
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}

Trait Implementations§

Source§

impl Clone for ReceiveAttributes

Source§

fn clone(&self) -> ReceiveAttributes

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 ReceiveAttributes

Source§

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

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

impl Default for ReceiveAttributes

Source§

fn default() -> ReceiveAttributes

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

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.