Skip to main content

FileSource

Struct FileSource 

Source
pub struct FileSource<'a> {
    pub c: &'a SysSpec,
    pub replay: Option<&'a dyn Fn(System, &[Option<FaceId>], &str, &mut Vec<String>) -> Result<System>>,
    /* private fields */
}
Expand description

系のファイルの読み方。ファイルは初めに要るときに 1 回だけ読み(lensbench_project::open::Source)、状態・経路・ プロジェクトの文字列・別の状態の系はそこから引く

Fields§

§c: &'a SysSpec§replay: Option<&'a dyn Fn(System, &[Option<FaceId>], &str, &mut Vec<String>) -> Result<System>>

serve で読み込んだ後の変更を当てる(CLI は None)

Implementations§

Source§

impl<'a> FileSource<'a>

Source

pub fn new( c: &'a SysSpec, replay: Option<&'a dyn Fn(System, &[Option<FaceId>], &str, &mut Vec<String>) -> Result<System>>, ) -> Self

CLI: ファイルは初めに要るときに読む

Source

pub fn loaded( c: &'a SysSpec, src: Arc<Source>, cur: &'a System, replay: &'a dyn Fn(System, &[Option<FaceId>], &str, &mut Vec<String>) -> Result<System>, ) -> Self

serve: 読んだときのファイル src と、読み込んだ系 cur から引く。今の構成・状態・経路は cur そのもの、 .zmx の別の構成は cur の多重構成の表から(変更が入ったまま)、ほかは src から読んで replay で変更を当てる

Trait Implementations§

Source§

impl Source for FileSource<'_>

Source§

fn is_project(&self) -> bool

プロジェクトファイル(光束・状態を名前で選ぶ)か。.zmx・系ファイルなら false
Source§

fn states(&self) -> Result<Vec<String>>

プロジェクトファイルの状態の名前(.zmx・系ファイルなら空)
Source§

fn beams(&self) -> Result<Vec<String>>

プロジェクトファイルの光束の名前(状態の名前と同じ所で選べる。光束なし・.zmx・系ファイルなら空)
Source§

fn state(&self) -> Option<String>

選んだ状態
Source§

fn paths(&self) -> Result<Vec<String>>

ビームスプリッターの経路の一覧(BS なし・.zmx なら空)
Source§

fn path(&self) -> Option<String>

選んだ経路
Source§

fn load(&self, v: &Variant, notes: &mut Vec<String>) -> Result<System>

別の読み方(光束・追跡する波長)で読んだ系。serve では読み込んだ後の変更(set・edit)も当て、当てなかった変更は notes に書く
Source§

fn project_text(&self) -> Result<Option<String>>

プロジェクトファイルの JSON の文字列(状態は当てない。.zmx・系ファイルなら None)
Source§

fn system_hash(&self, s: &System) -> Result<String>

系の hash(系ファイルの形の。結果・書き出しの provenance に刻む)
Source§

fn variant(&self, beam: &str, notes: &mut Vec<String>) -> Result<System, Error>

別の光束(.zmx は構成の番号、プロジェクトは状態の名前)で読んだ系(Source::load)

Auto Trait Implementations§

§

impl<'a> !Freeze for FileSource<'a>

§

impl<'a> !RefUnwindSafe for FileSource<'a>

§

impl<'a> !Send for FileSource<'a>

§

impl<'a> !Sync for FileSource<'a>

§

impl<'a> !UnwindSafe for FileSource<'a>

§

impl<'a> Unpin for FileSource<'a>

§

impl<'a> UnsafeUnpin for FileSource<'a>

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