Skip to main content

CreditHeader

Struct CreditHeader 

Source
pub struct CreditHeader {
    pub endpoint: String,
    pub filter: String,
    pub limit: u64,
}
Expand description

CREDIT header (kind 5).

The L2 credit of decisions/0003 §4.2-§4.3: which subscription, and how many messages that subscription will accept in total. Three keys, all required — a subscription is (endpoint, filter) on the connection the frame arrives on, and an absent limit would be indistinguishable from a limit of zero, which is the pause.

The limit is absolute and cumulative, not a delta. It counts messages delivered on that subscription since it was created, so a lost frame costs nothing and a duplicated one changes nothing. It is also monotone at the receiver: a broker keeps the highest limit it has seen, which is what makes a reordered frame harmless on a transport that does not order the streams control frames ride. Monotone is the whole rule: a receiver ignores any limit that is not strictly greater than the standing one, so restating a number already delivered changes nothing unless the subscription had exhausted its credit anyway. v0 offers no way to lower a standing limit. The only pause is the 0 a fresh subscription starts at, so a consumer that wants to stay in control grants in increments it is willing to receive. AMQP 1.0 can shrink link-credit against an absolute baseline [amqp10 §5.1]; this frame cannot, and a peer that reads it as if it could would wait for a stop no broker can deliver.

Fields§

§endpoint: String

Endpoint path of the queue the subscription is on.

§filter: String

Topic filter of the subscription. A decoded header’s filter has passed filter::validate.

§limit: u64

Messages this subscription will accept in total, counted from its creation.

Implementations§

Source§

impl CreditHeader

Source

pub fn new( endpoint: impl Into<String>, filter: impl Into<String>, limit: u64, ) -> CreditHeader

A header granting limit to the subscription (endpoint, filter).

Source

pub fn encode(&self) -> Vec<u8> ⓘ

Encodes the header.

Source

pub fn encode_into(&self, out: &mut Vec<u8>)

Appends the encoded header to out, for a send path that reuses a buffer (B-250). The canonical form has one implementation and this is it; Self::encode is a wrapper.

Source

pub fn decode(bytes: &[u8]) -> Result<CreditHeader, HeaderError>

Decodes the header.

Trait Implementations§

Source§

impl Clone for CreditHeader

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for CreditHeader

Source§

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

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

impl Eq for CreditHeader

Source§

impl PartialEq for CreditHeader

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CreditHeader

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.