[][src]Struct zekin_data_structure::Module

pub struct Module { /* fields omitted */ }

主模块,用于统筹资源

Implementations

impl Module[src]

pub fn cities(&self) -> &Vec<Rc<City>>[src]

存储所有城市

pub fn ways(&self) -> &Vec<Rc<Way>>[src]

存储所有交通方式

pub fn people(&self) -> &Vec<Rc<Person>>[src]

存储所有乘客

pub fn time(&self) -> &i32[src]

系统时间

impl Module[src]

pub fn add_city(&mut self, id: i32, name: String, risk_level: RiskLevel)[src]

添加一座城市

pub fn add_way(
    &mut self,
    id: i32,
    way_type: Type,
    cost_time: i32,
    start_time: i32,
    start_city_index: usize,
    end_city_index: usize
) -> Result<(), ModuleErr>
[src]

添加一个交通方式

pub fn add_person(
    &mut self,
    start_city_index: usize,
    end_city_index: usize,
    time_limit: Option<i32>
) -> Result<(), ModuleErr>
[src]

添加一个乘客

pub fn step(&mut self)[src]

使Module的时间前进1小时,并更新各个乘客的状态

pub fn clear(&mut self)[src]

清理Module的数据

Trait Implementations

impl Debug for Module[src]

impl Default for Module[src]

impl From<Module> for JsValue[src]

impl FromWasmAbi for Module[src]

type Abi = u32

The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more

impl IntoWasmAbi for Module[src]

type Abi = u32

The wasm ABI type that this converts into when crossing the ABI boundary. Read more

impl OptionFromWasmAbi for Module[src]

impl OptionIntoWasmAbi for Module[src]

impl RefFromWasmAbi for Module[src]

type Abi = u32

The wasm ABI type references to Self are recovered from.

type Anchor = Ref<'static, Module>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don't persist beyond one function call, and so that they remain anonymous. Read more

impl RefMutFromWasmAbi for Module[src]

type Abi = u32

Same as RefFromWasmAbi::Abi

type Anchor = RefMut<'static, Module>

Same as RefFromWasmAbi::Anchor

impl WasmDescribe for Module[src]

Auto Trait Implementations

impl !RefUnwindSafe for Module

impl !Send for Module

impl !Sync for Module

impl Unpin for Module

impl !UnwindSafe for Module

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ReturnWasmAbi for T where
    T: IntoWasmAbi
[src]

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.