pub trait CompilationTarget {
type Compiler: ArtifactCompiler;
type Loaded: Clone;
// Required methods
fn compiler(&self) -> &Self::Compiler;
fn persists(&self) -> bool;
fn stored(
&mut self,
id: &ArtifactId<VariantOf<Self>>,
) -> Option<ArtifactOf<Self>>;
fn load(
&mut self,
id: &ArtifactId<VariantOf<Self>>,
artifact: &ArtifactOf<Self>,
) -> Result<Self::Loaded, CompilationError>;
fn store(
&mut self,
id: &ArtifactId<VariantOf<Self>>,
artifact: ArtifactOf<Self>,
source: Option<&str>,
) -> bool;
// Provided method
fn stored_for_source(&mut self, source: &str) -> Option<ArtifactOf<Self>> { ... }
}Expand description
The half of a backend’s compilation that runs only where the server does: the compilation store, and the loads on the server’s context.
Required Associated Types§
Sourcetype Compiler: ArtifactCompiler
type Compiler: ArtifactCompiler
The half that may run on any thread.
Required Methods§
Sourcefn persists(&self) -> bool
fn persists(&self) -> bool
Whether artifacts are kept between runs, which is what binds the
loaded kernels to the active environment: a switch replaces the store
they mirror, so the KernelLoader drops them.
Sourcefn stored(
&mut self,
id: &ArtifactId<VariantOf<Self>>,
) -> Option<ArtifactOf<Self>>
fn stored( &mut self, id: &ArtifactId<VariantOf<Self>>, ) -> Option<ArtifactOf<Self>>
Takes the artifact the compilation store holds for id out of it, to
be loaded; None when there is no store or it holds nothing for id.
Sourcefn load(
&mut self,
id: &ArtifactId<VariantOf<Self>>,
artifact: &ArtifactOf<Self>,
) -> Result<Self::Loaded, CompilationError>
fn load( &mut self, id: &ArtifactId<VariantOf<Self>>, artifact: &ArtifactOf<Self>, ) -> Result<Self::Loaded, CompilationError>
Loads artifact on the device.
Sourcefn store(
&mut self,
id: &ArtifactId<VariantOf<Self>>,
artifact: ArtifactOf<Self>,
source: Option<&str>,
) -> bool
fn store( &mut self, id: &ArtifactId<VariantOf<Self>>, artifact: ArtifactOf<Self>, source: Option<&str>, ) -> bool
Keeps a loaded artifact in the compilation store under id and, when
given, under the source it was finalized from. Whether the store took
it, as store_compiled answers: false with
no store.
Called after load, so an artifact the device refused is
never handed back on the next run.
Provided Methods§
Sourcefn stored_for_source(&mut self, source: &str) -> Option<ArtifactOf<Self>>
fn stored_for_source(&mut self, source: &str) -> Option<ArtifactOf<Self>>
Takes the artifact the compilation store holds for another kernel
finalized from source out of it — see
ArtifactCompiler::source — for store to
put back under the kernel asking. None, the default, for a backend
that keeps no artifact by source.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".