Struct CheckArtifacts
pub struct CheckArtifacts {
pub rust_code: String,
pub dependencies: Vec<CrateDependency>,
pub source_map: SourceMap,
pub interner: Interner,
}Expand description
Compile LOGOS source and write output to a directory as a Cargo project.
Creates a complete Cargo project structure with:
src/main.rscontaining the generated Rust codeCargo.tomlwith runtime dependenciescrates/directory with runtime crate copies
§Arguments
source- LOGOS source code as a stringoutput_dir- Directory to create the Cargo project in
§Errors
Returns CompileError if:
- Compilation fails (wrapped as
CompileError::Parse) - File system operations fail (wrapped as
CompileError::Io)
§Example
let source = "## Main\nShow \"Hello\".";
compile_to_dir(source, Path::new("/tmp/my_project"))?;
// Now /tmp/my_project is a buildable Cargo projectEverything rustc_check needs short of running cargo: generated Rust,
dependencies, the POPULATED rustc→LOGOS source map, and the interner the
program was compiled with — the substrate the diagnostic bridge translates
through.
Fields§
§rust_code: String§dependencies: Vec<CrateDependency>§source_map: SourceMap§interner: InternerAuto Trait Implementations§
impl Freeze for CheckArtifacts
impl RefUnwindSafe for CheckArtifacts
impl Send for CheckArtifacts
impl Sync for CheckArtifacts
impl Unpin for CheckArtifacts
impl UnsafeUnpin for CheckArtifacts
impl UnwindSafe for CheckArtifacts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.