Skip to main content

KernelInstance

Struct KernelInstance 

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

一个节点持有的算子实例。Drop 时回调 C 侧 destroy(RAII)。

Implementations§

Source§

impl KernelInstance

Source

pub fn create(kernel_name: &str) -> Result<Self>

Source

pub fn create_route(config: RouteConfig) -> Self

Source

pub fn kernel_name(&self) -> &str

Source

pub fn language(&self) -> KernelLanguage

Source

pub unsafe fn fill_contract( kernel_name: &str, contract: *mut c_void, ) -> Result<()>

调 C 侧 get_contract 填充契约。

§Safety

contract 必须是指向存活 Contract 的有效指针,且在本调用期间不被其它代码访问。

Source

pub unsafe fn open(&self, ctx: *mut c_void) -> i32

以下三者传入的 ctx 是 *mut Context 的擦除形式。 调用期间不持有任何引擎锁(docs/design.md §7.0 R1)。

§Safety

ctx 必须是指向存活 crate::context::Context 的有效指针,且调用方持有 本节点的独占令牌(docs/design.md §7.0 R3)—— 否则算子回调可能与引擎 对同一 Context 的访问竞争。

Source

pub unsafe fn process(&self, ctx: *mut c_void) -> i32

§Safety

同 Self::open。

Source

pub unsafe fn close(&self, ctx: *mut c_void) -> i32

§Safety

同 Self::open。

Trait Implementations§

Source§

impl Debug for KernelInstance

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for KernelInstance

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
Source§

impl Send for KernelInstance

Source§

impl Sync for KernelInstance

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.