pub struct HeaderFields;Expand description
The delivery’s headers, built from the row’s header fields: set by
InboxSpec::header_fields.
§Examples
use ruststream::HeaderMap;
use ruststream::runtime::{Input, SoloCarried};
use ruststream_sqlx::dialect::Column;
use ruststream_sqlx::spec;
use ruststream_sqlx::{HeaderFields, InboxSpec, InboxTable, put_header};
#[derive(Debug, Clone, sqlx::FromRow)]
pub struct Signal {
id: i64,
trace: Option<String>,
sensor: String,
value: f64,
}
impl InboxTable for Signal {
type Id = i64;
// `trace` reads as a header; a row without one has no `trace` header.
type Table = InboxSpec<(spec::HeaderFields,)>;
const TABLE: Self::Table = InboxSpec::new("signals", Column::new("id").generated())
.data(&[Column::new("trace"), Column::new("sensor"), Column::new("value")])
.header_fields();
fn id(&self) -> &i64 {
&self.id
}
}
impl HeaderFields for Signal {
const NAMES: &'static [&'static str] = &["trace"];
fn header_map(&self) -> HeaderMap {
let mut headers = HeaderMap::with_capacity(Self::NAMES.len());
put_header(&mut headers, "trace", &self.trace);
headers
}
}Trait Implementations§
Source§impl Debug for HeaderFields
impl Debug for HeaderFields
Source§impl Declaration for HeaderFields
impl Declaration for HeaderFields
Source§type Headers = Set<HeaderFields>
type Headers = Set<HeaderFields>
The delivery’s headers:
Headers or
HeaderFields.Source§type RetryAfter = Unset
type RetryAfter = Unset
The time a retried row is due:
RetryAfter.Source§type ProcessedAt = Unset
type ProcessedAt = Unset
The time a row was processed:
ProcessedAt.Source§type Opening = Unset
type Opening = Unset
What the table’s transactions open at:
Opens; unset for the database’s
default.Source§type OwnClaim = Unset
type OwnClaim = Unset
The service’s own claim:
own::Claim.Source§type OwnFetch = Unset
type OwnFetch = Unset
The service’s own fetch:
own::Fetch.Source§type OwnRetry = Unset
type OwnRetry = Unset
The service’s own retry:
own::Retry.Source§type OwnRetryAfter = Unset
type OwnRetryAfter = Unset
The service’s own delayed retry:
own::RetryAfter.Source§type OwnDiscard = Unset
type OwnDiscard = Unset
The service’s own discard:
own::Discard.Source§type OwnDeadLetter = Unset
type OwnDeadLetter = Unset
The service’s own dead letter:
own::DeadLetter.Source§type OwnExtend = Unset
type OwnExtend = Unset
The service’s own lease extension:
own::Extend.Source§type OwnUnlock = Unset
type OwnUnlock = Unset
The service’s own unlock:
own::Unlock.Auto Trait Implementations§
impl Freeze for HeaderFields
impl RefUnwindSafe for HeaderFields
impl Send for HeaderFields
impl Sync for HeaderFields
impl Unpin for HeaderFields
impl UnsafeUnpin for HeaderFields
impl UnwindSafe for HeaderFields
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
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more