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
impl ReceiveAttributes
Sourcepub fn new() -> Self
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}Sourcepub fn action(self, action: impl Into<String>) -> Self
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}Sourcepub fn media_type(self, media_type: ReceiveMediaType) -> Self
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}Sourcepub fn method(self, method: impl Into<String>) -> Self
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}Sourcepub fn page_size(self, page_size: ReceivePageSize) -> Self
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}Sourcepub fn store_media(self, store_media: bool) -> Self
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
impl Clone for ReceiveAttributes
Source§fn clone(&self) -> ReceiveAttributes
fn clone(&self) -> ReceiveAttributes
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReceiveAttributes
impl Debug for ReceiveAttributes
Source§impl Default for ReceiveAttributes
impl Default for ReceiveAttributes
Source§fn default() -> ReceiveAttributes
fn default() -> ReceiveAttributes
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ReceiveAttributes
impl RefUnwindSafe for ReceiveAttributes
impl Send for ReceiveAttributes
impl Sync for ReceiveAttributes
impl Unpin for ReceiveAttributes
impl UnwindSafe for ReceiveAttributes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more