Skip to main content

Ports

Struct Ports 

Source
pub struct Ports {
Show 15 fields pub config: Arc<dyn Config>, pub db: Option<Arc<dyn Database>>, pub mailer: Option<Arc<dyn Mailer>>, pub captcha: Option<Arc<dyn Captcha>>, pub rate_limiter: Option<Arc<dyn RateLimiter>>, pub signer: Option<Arc<dyn Signer>>, pub kv: Option<Arc<dyn KeyValue>>, pub blob: Option<Arc<dyn Blob>>, pub push: Option<Arc<dyn Push>>, pub payments: Option<Arc<dyn Payments>>, pub http: Option<Arc<dyn HttpClient>>, pub clock: Option<Arc<dyn Clock>>, pub id_gen: Option<Arc<dyn IdGen>>, pub defer: Option<Arc<dyn Defer>>, pub dispatcher: Option<Arc<dyn Dispatcher>>,
}
Expand description

The per-request bundle of resolved port implementations plus the typed config the runtime built from environment/secrets.

Every port is optional: the Cloudflare runtime resolves what the venture’s bindings actually provide and leaves the rest None.

Fields§

§config: Arc<dyn Config>§db: Option<Arc<dyn Database>>§mailer: Option<Arc<dyn Mailer>>§captcha: Option<Arc<dyn Captcha>>§rate_limiter: Option<Arc<dyn RateLimiter>>§signer: Option<Arc<dyn Signer>>§kv: Option<Arc<dyn KeyValue>>§blob: Option<Arc<dyn Blob>>§push: Option<Arc<dyn Push>>§payments: Option<Arc<dyn Payments>>§http: Option<Arc<dyn HttpClient>>§clock: Option<Arc<dyn Clock>>§id_gen: Option<Arc<dyn IdGen>>§defer: Option<Arc<dyn Defer>>§dispatcher: Option<Arc<dyn Dispatcher>>

Set by the runtime when the venture mounts sidecar modules. Not a Port, so view_for never copies it and no module can reach it.

Implementations§

Source§

impl Ports

Source

pub fn empty() -> Self

An empty bundle with no ports resolved and an EmptyConfig.

Source

pub fn with_config(config: Arc<dyn Config>) -> Self

Source

pub fn provides(&self) -> Vec<Port>

The set of ports this bundle actually provides.

Source

pub fn view_for(&self, module: &dyn Module) -> Self

A copy of this bundle in which every port the module did not declare in requires() or optional() is None, so a module cannot use what it did not declare (issue #3). Undeclared-but-provided ports are logged once per module by Harness::build.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Ports

§

impl !UnwindSafe for Ports

§

impl Freeze for Ports

§

impl Send for Ports

§

impl Sync for Ports

§

impl Unpin for Ports

§

impl UnsafeUnpin for Ports

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more