BasicProperties

Struct BasicProperties 

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

AMQP message properties.

User is recommended to use the chainable setter to create desired propertities.

See also message properties.

§Example

let basic_props = BasicProperties::default()
    .with_content_type("application/json")
    .with_persistence(true)
    .with_message_type("app1.notifications.orders.created")
    .with_app_id("app1")
    .finish();

Implementations§

Source§

impl BasicProperties

Source

pub fn new( content_type: Option<String>, content_encoding: Option<String>, headers: Option<FieldTable>, delivery_mode: Option<u8>, priority: Option<u8>, correlation_id: Option<String>, reply_to: Option<String>, expiration: Option<String>, message_id: Option<String>, timestamp: Option<u64>, message_type: Option<String>, user_id: Option<String>, app_id: Option<String>, cluster_id: Option<String>, ) -> BasicProperties

Returns a new instance.

Source

pub fn content_type(&self) -> Option<&String>

Source

pub fn with_content_type(&mut self, content_type: &str) -> &mut BasicProperties

Chainable setter of content type.

§Default: None
Source

pub fn content_encoding(&self) -> Option<&String>

Source

pub fn with_content_encoding( &mut self, content_encoding: &str, ) -> &mut BasicProperties

Chainable setter of content encoding.

§Default: None
Source

pub fn headers(&self) -> Option<&FieldTable>

Source

pub fn with_headers(&mut self, headers: FieldTable) -> &mut BasicProperties

Chainable setter of headers.

§Default: None
Source

pub fn delivery_mode(&self) -> Option<u8>

Source

pub fn with_delivery_mode(&mut self, delivery_mode: u8) -> &mut BasicProperties

Chainable setter of delivery mode. Prefer with_persistence as it is more to the point.

delivery_mode: either DELIVERY_MODE_TRANSIENT or DELIVERY_MODE_PERSISTENT

§Default: None
§Example
let basic_props = BasicProperties::default()
    .with_content_type("application/json")
    .with_delivery_mode(DELIVERY_MODE_PERSISTENT)
    .finish();
Source

pub fn with_persistence(&mut self, persistent: bool) -> &mut BasicProperties

Marks a message as persistent (or not) using a boolean. When in doubt, prefer publishing messages as persistent.

persistent: true for persistent delivery mode (2), false for transient (1) with_persistence(true) is equivalent to with_delivery_mode(DELIVERY_MODE_PERSISTENT). with_persistence(false) is equivalent to with_delivery_mode(DELIVERY_MODE_TRANSIENT).

§Example
use amqprs::BasicProperties;
use amqprs::{DELIVERY_MODE_PERSISTENT, DELIVERY_MODE_TRANSIENT};
let mut prop1 = BasicProperties::default()
    .with_persistence(true)
    .finish();
let mut prop2 = BasicProperties::default()
    .with_delivery_mode(DELIVERY_MODE_PERSISTENT)
    .finish();
assert_eq!(prop1.delivery_mode(), prop2.delivery_mode());
prop1.with_persistence(false);
prop2.with_delivery_mode(DELIVERY_MODE_TRANSIENT);
assert_eq!(prop1.delivery_mode(), prop2.delivery_mode());
Source

pub fn priority(&self) -> Option<u8>

Source

pub fn with_priority(&mut self, priority: u8) -> &mut BasicProperties

Chainable setter of priority.

priority: message priority, 0 to 9

§Default: None
Source

pub fn correlation_id(&self) -> Option<&String>

Source

pub fn with_correlation_id( &mut self, correlation_id: &str, ) -> &mut BasicProperties

Chainable setter of correlation id.

correlation_id: application correlation identifier

§Default: None
Source

pub fn reply_to(&self) -> Option<&String>

Source

pub fn with_reply_to(&mut self, reply_to: &str) -> &mut BasicProperties

Chainable setter of reply_to.

§Default: None
Source

pub fn expiration(&self) -> Option<&String>

Source

pub fn with_expiration(&mut self, expiration: &str) -> &mut BasicProperties

Chainable setter of expiration.

§Default: None
Source

pub fn message_id(&self) -> Option<&String>

Source

pub fn with_message_id(&mut self, message_id: &str) -> &mut BasicProperties

Chainable setter of message_id.

§Default: None
Source

pub fn timestamp(&self) -> Option<u64>

Source

pub fn with_timestamp(&mut self, timestamp: u64) -> &mut BasicProperties

Chainable setter of timestamp.

§Default: None
Source

pub fn message_type(&self) -> Option<&String>

Source

pub fn with_message_type(&mut self, message_type: &str) -> &mut BasicProperties

Chainable setter of message_type.

§Default: None
Source

pub fn user_id(&self) -> Option<&String>

Source

pub fn with_user_id(&mut self, user_id: &str) -> &mut BasicProperties

Chainable setter of user_id.

§Default: None
Source

pub fn app_id(&self) -> Option<&String>

Source

pub fn with_app_id(&mut self, app_id: &str) -> &mut BasicProperties

Chainable setter of app_id.

§Default: None
Source

pub fn cluster_id(&self) -> Option<&String>

Source

pub fn with_cluster_id(&mut self, cluster_id: &str) -> &mut BasicProperties

Chainable setter of cluster_id.

§Default: None
Source

pub fn finish(&mut self) -> BasicProperties

Finish chaining and returns a new instance according to chained configurations.

Trait Implementations§

Source§

impl Clone for BasicProperties

Source§

fn clone(&self) -> BasicProperties

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 BasicProperties

Source§

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

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

impl Default for BasicProperties

Source§

fn default() -> BasicProperties

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

impl<'de> Deserialize<'de> for BasicProperties

Source§

fn deserialize<D>( deserializer: D, ) -> Result<BasicProperties, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for BasicProperties

Source§

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

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

impl Serialize for BasicProperties

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,