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 record_sso_bridge(&self, status: u16)
pub fn record_sso_bridge(&self, status: u16)
Record what the SSO bridge just answered. Called from the proxy as
ssodh/init responses pass through — see SsoBridge.
A poisoned lock is recovered from rather than propagated: this is observability, and it must never be the reason a proxied trading call fails.
Sourcepub fn sso_bridge(&self) -> Option<SsoBridge>
pub fn sso_bridge(&self) -> Option<SsoBridge>
The last observed SSO bridge state, if any call has been seen.
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 !RefUnwindSafe for AppState
impl !UnwindSafe for AppState
impl Freeze for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin 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