Skip to main content

Kernel

Struct Kernel 

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

内核结构体,是工业协议应用的入口点。

通过 KernelBuilder 构建,使用 Builder 模式配置协议、连接策略等参数, 然后调用 boot 启动,使用完毕后调用 shutdown 关闭。

Implementations§

Source§

impl Kernel

Source

pub fn builder() -> KernelBuilder

创建内核构建器。

Source

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

启动内核,校验所有配置文件中的设备均有对应协议注册。

Source

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

关闭内核,断开所有设备连接并停止网关引擎。

Source

pub fn protocol_registry(&self) -> &ProtocolRegistry

获取协议注册表的只读引用。

Source

pub fn connection_manager(&self) -> &ConnectionManager

获取连接管理器的只读引用。

Source

pub fn config(&self) -> &ConfigRepository

获取配置仓库的只读引用。

§Panics

如果未通过 builder 加载配置(即 config_from_str 或 config_from_file 未被调用)。

Source

pub fn event_bus(&self) -> &EventBus

获取事件总线的只读引用。

Source

pub fn gateway(&self) -> &GatewayEngine

获取网关引擎的只读引用。

Source

pub fn gateway_mut(&mut self) -> &mut GatewayEngine

获取网关引擎的可变引用。

Auto Trait Implementations§

§

impl !Freeze for Kernel

§

impl !RefUnwindSafe for Kernel

§

impl !UnwindSafe for Kernel

§

impl Send for Kernel

§

impl Sync for Kernel

§

impl Unpin for Kernel

§

impl UnsafeUnpin for Kernel

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

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.