Skip to main content

NylonRingHost

Struct NylonRingHost 

Source
pub struct NylonRingHost { /* private fields */ }
Expand description

The main host for loading and managing nylon-ring plugins.

Implementations§

Source§

impl NylonRingHost

Source

pub fn new() -> Self

Create a new empty host.

Source

pub fn with_stream_capacity(stream_capacity: usize) -> Self

Create a host with a bounded per-stream frame capacity.

Source

pub fn load(&mut self, name: &str, path: &str) -> Result<()>

Load a plugin from the specified path with a given name.

The plugin must export nylon_ring_get_plugin and match this host’s ABI_VERSION exactly.

Source

pub fn load_pinned(&mut self, name: &str, path: &str) -> Result<()>

Load a plugin that opts out of unload/reload for the life of the process.

Per-call guards on a pinned plugin skip the in-flight tracker RMWs (the dominant per-call cost on short paths); in exchange the plugin can never be unloaded, reloaded, or replaced, its shutdown callback never runs, and its library handle is intentionally leaked at host drop. Streams still take tracker slots.

Source

pub fn unload(&mut self, name: &str) -> Result<()>

Unload a plugin by name.

Source

pub async fn unload_with_grace( &mut self, name: &str, grace: Duration, ) -> Result<()>

Stop accepting new calls, then wait for tracked calls to drain.

Source

pub fn reload(&mut self) -> Result<()>

Reload all plugins.

Source

pub async fn reload_with_grace(&mut self, grace: Duration) -> Result<()>

Reload all plugins and wait for calls on replaced instances to drain.

Source

pub fn plugin(&self, name: &str) -> Option<PluginHandle>

Get a handle to a loaded plugin by name.

Source

pub fn metrics(&self) -> HostMetrics

Capture lightweight host metrics without allocating the shard map.

Source

pub unsafe fn get_host_ext(host_ctx: *mut c_void) -> *const NrHostExt

Get host extension pointer from host_ctx.

§Safety

The caller must ensure that host_ctx is a valid pointer to a HostContext instance that was created by this host, or a null pointer.

Trait Implementations§

Source§

impl Default for NylonRingHost

Source§

fn default() -> Self

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

impl Drop for NylonRingHost

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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, 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, 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.