Skip to main content

Session

Struct Session 

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

serve の 1 つの場: 読み込んだ系・変更の記録・元に戻す段・走っている最適化などの進み具合と、要求で与えたパスの扱い。 系を変える要求は場ごとに 1 つずつ順に、読むだけの要求(Access::Read)は並行に処理する。 最適化などの長い要求(Access::Long)は始めたときの系で回し、その間も他の要求を止めない。TCP・パイプの serve は 1 つの場を全部の接続で共有し、GUI は global の場を、 試験は場を別々に作って使う

Implementations§

Source§

impl Session

Source

pub fn optimize_progress(&self) -> Option<Vec<f64>>

走っている最適化の、反復ごとの評価関数の値(走っていなければ None)。同じプロセスから呼ぶ(GUI の進み具合)

Source

pub fn optimize_cancel(&self)

走っている最適化を止める(次の反復の終わりで止まり、そこまでの結果を返す)。同じプロセスから呼ぶ

Source§

impl Session

Source

pub fn tolerance_progress(&self) -> Option<(usize, usize)>

走っている公差のモンテカルロの (終えた評価, 評価の数)(感度の 2 × 公差の数 + 試行の数。走っていなければ None)

Source

pub fn tolerance_cancel(&self)

走っている公差のモンテカルロを止める(走っている試行は終わらせ、そこまでの結果を返す)。同じプロセスから呼ぶ

Source§

impl Session

Source

pub fn swap_progress(&self) -> Option<(usize, usize)>

走っている差し替え探索の (終えた組, 組の数)(走っていなければ None)。同じプロセスから呼ぶ

Source

pub fn swap_cancel(&self)

走っている差し替え探索を止める(走っている組は終わらせ、そこまでの結果を返す)。同じプロセスから呼ぶ

Source§

impl Session

Source

pub fn new() -> Self

空の場(要求で与えたパスはそのまま読み書きする)

Source

pub fn with_files(files: Files) -> Self

要求で与えたパスの扱いを決めた空の場

Source

pub fn open(&self, spec: LoadSpec, threads: Option<usize>) -> Result<()>

系を読んで場に置く(起動の引数で与えた系。要求で与えたパスの扱いは当てない)

Source

pub fn files(&self) -> &Files

要求で与えたパスの扱い

Source

pub fn handle( &self, method: &str, params: &Value, bins: Vec<Bin>, threads: Option<usize>, ) -> Result<(Value, Vec<Bin>), CallError>

要求を 1 つ処理する(要求を運ぶ道から。配列は bin で受け渡す)。panic は誤りにする

Source§

impl Session

Source

pub fn call( &self, method: &str, params: &Value, threads: Option<usize>, ) -> Result<Value, CallError>

serve と同じ method を同じプロセスの中から呼ぶ(GUI が使う)。params・result は TCP の要求と同じ JSON。 系は場に 1 つで、TCP の要求と同じく 1 つずつ順に処理する。bin(配列)を使う trace・echo は JSON の並びで渡す。結果の配列が要るときは call_arrays。shutdown はプロセスを止めない。

Source

pub fn call_arrays( &self, method: &str, params: &Value, threads: Option<usize>, ) -> Result<(Value, Arrays), CallError>

call と同じで、結果の配列(TCP では bin で返るもの)も受け取る

Source

pub fn call_answer( &self, method: &str, params: &Value, threads: Option<usize>, ) -> Result<(Answer, Arrays), CallError>

call_arrays と同じで、結果の型が決まっている method(面の表・最適化・差し替え探索・公差・ズーム軌跡)は JSON を通さずに型のまま返す(Answer。GUI が使う)

Source

pub fn request( &self, req: Request, threads: Option<usize>, ) -> Result<(Answer, Arrays), CallError>

型の要求を同じプロセスの中から渡す(JSON を通さない。GUI が使う)。答えは call_answer と同じ

Source

pub fn preview_layout( &self, load: &Value, opts: &Value, ) -> Result<Value, CallError>

系を読んで(load と同じ params)、そのレイアウト図(layout と同じ結果)を返す。読み込んだ系は変えず、 他の要求の順番も待たない。GUI が、解析を回している間も組合せの図だけ先に描き直すのに使う

Source

pub fn preview( &self, load: &LoadReq, opts: &LayoutReq, ) -> Result<Value, CallError>

Source

pub fn catalog(&self, req: &Request) -> Result<Value, CallError>

カタログの要求(glasses・lenses・catalog_search・catalog_items・catalog_edit・catalog_fill)を、 読み込んだ系に関係なく、他の要求の順番も待たずに処理する。GUI が、解析を回している間もカタログを読み・ 下書きの worker からユーザーカタログを変えるのに使う(catalog_add は読み込んだ系が要るので Session::request で)

Source

pub fn browse(&self, method: &str, params: &Value) -> Result<Value, CallError>

Session::catalog の JSON の口(method と serve の params)

Trait Implementations§

Source§

impl Default for Session

Source§

fn default() -> Self

Returns the “default value” for a type. 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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Parallelizable for T
where T: Send + Sync,

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,