Syscall

2024-05-27

最后编辑于:2024-09-15

    #umi
    #OS

系统调用

struct

AHandlers -> Handlers

struct Handler<K, P, O> {
	map: HashMap<K, AnyHandler<P, O>, RandomState>,
}

RandomState外部的哈希算法

type AnyHandler<P, O> = Box<dyn for<'a> Handler<'a, Param = P, Output = O>>

最终构建出一个HashMap<Scn, AnyHandler<ScParam, ScRet>>

map

pub fn map<H, Marker: 'static>(mut self, key: K, handler: H) -> Self
where
	H: for<'any> IntoHandler<Marker, Param<'any> = P, Output<'any> = O> + 'static,
{
	self.insert(key, handler);
	self
}

insert之后返回自身,进行链式调用