pub struct AppState { /* private fields */ }Expand description
State shared across all axum handlers.
Implementations§
Source§impl AppState
impl AppState
Sourcepub fn new(client: Client) -> Self
pub fn new(client: Client) -> Self
Build app state from a configured bezant::Client.
Debug endpoints are disabled by default. Use
AppState::with_debug_token to enable them with token gating.
Events are disabled by default. Use AppState::with_events to
attach a connector handle.
Sourcepub fn with_debug_token(client: Client, token: impl Into<String>) -> Self
pub fn with_debug_token(client: Client, token: impl Into<String>) -> Self
Enable the /debug/* endpoints, requiring the given token on
every request (via ?token=… or X-Bezant-Debug-Token header).
Without this, all /debug/* routes 404.
Security: the cookie jar holds live IBKR session cookies
— anyone who can read it can resume the IBKR session and
trade the account. Pick a long, random token (>=32 bytes
from /dev/urandom) and treat it like a credential.
Sourcepub fn with_events(self, events: EventsHandle) -> Self
pub fn with_events(self, events: EventsHandle) -> Self
Return a new state with the given events handle attached. The
handle is what powers /events/* reads. Without it, those routes
return 503.
Sourcepub fn debug_token(&self) -> Option<&str>
pub fn debug_token(&self) -> Option<&str>
Borrow the configured debug token, if any.
Sourcepub fn events(&self) -> Option<&EventsHandle>
pub fn events(&self) -> Option<&EventsHandle>
Borrow the events handle, if attached.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppState
impl !RefUnwindSafe for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
impl !UnwindSafe for AppState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
x-request-id as the header name. Read more§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
x-request-id as the header name. Read more§fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
413 Payload Too Large responses. Read more