Skip to main content

HttpIngress

Struct HttpIngress 

Source
pub struct HttpIngress<R = ()> { /* private fields */ }
Expand description

HTTP Ingress Circuit Builder.

Wires HTTP inputs to Ranvier Circuits. This is NOT a web server—it’s a circuit wiring tool.

Ingress is part of Schematic (separate layer: Ingress → Circuit → Egress)

Implementations§

Source§

impl<R> HttpIngress<R>
where R: ResourceRequirement + Clone + Send + Sync + 'static,

Source

pub fn new() -> Self

Create a new empty HttpIngress builder.

Source

pub fn bind(self, addr: impl Into<String>) -> Self

Set the bind address for the server.

Source

pub fn route<E>( self, path: impl Into<String>, circuit: Axon<(), String, E, R>, ) -> Self
where E: Send + 'static + Debug,

Register a route with a circuit.

Source

pub fn route_method<E>( self, method: Method, path: impl Into<String>, circuit: Axon<(), String, E, R>, ) -> Self
where E: Send + 'static + Debug,

Register a route with a specific HTTP method.

§Example
Ranvier::http()
    .route_method(Method::POST, "/users", create_user_circuit)
Source

pub fn fallback<E>(self, circuit: Axon<(), String, E, R>) -> Self
where E: Send + 'static + Debug,

Set a fallback circuit for unmatched routes.

§Example
let not_found = Axon::new("NotFound").then(|_| async { "404 Not Found" });
Ranvier::http()
    .route("/", home)
    .fallback(not_found)
Source

pub async fn run(self, resources: R) -> Result<(), Box<dyn Error + Send + Sync>>

Run the HTTP server with required resources.

Source

pub fn into_raw_service(self, resources: R) -> RawIngressService<R>

Convert to a raw Tower Service for integration with existing Tower stacks.

This is the “escape hatch” per Discussion 193:

“Raw API는 Flat API의 탈출구다.”

§Example
let ingress = Ranvier::http()
    .bind(":3000")
    .route("/", circuit);

let raw_service = ingress.into_raw_service();
// Use raw_service with existing Tower infrastructure

Trait Implementations§

Source§

impl<R> Default for HttpIngress<R>
where R: ResourceRequirement + Clone + Send + Sync + 'static,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<R> Freeze for HttpIngress<R>

§

impl<R = ()> !RefUnwindSafe for HttpIngress<R>

§

impl<R> Send for HttpIngress<R>
where R: Send,

§

impl<R> Sync for HttpIngress<R>
where R: Sync,

§

impl<R> Unpin for HttpIngress<R>
where R: Unpin,

§

impl<R = ()> !UnwindSafe for HttpIngress<R>

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

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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