pub struct SourceCode {
pub source: String,
pub path: Option<PathBuf>,
}Expand description
The SourceCode unit is the smallest unit of compilation that can be passed to the compiler
Fields§
§source: Stringthe source code to be compiled
path: Option<PathBuf>the location this code was loaded from
Implementations§
Trait Implementations§
Source§impl Clone for SourceCode
impl Clone for SourceCode
Source§fn clone(&self) -> SourceCode
fn clone(&self) -> SourceCode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Compilable for SourceCode
impl Compilable for SourceCode
type T = SourceCode
fn containers(self) -> Vec<Self::T>
Source§impl Debug for SourceCode
impl Debug for SourceCode
Source§impl<'de> Deserialize<'de> for SourceCode
impl<'de> Deserialize<'de> for SourceCode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&str> for SourceCode
impl From<&str> for SourceCode
Source§impl From<String> for SourceCode
impl From<String> for SourceCode
Source§impl Serialize for SourceCode
impl Serialize for SourceCode
Source§impl SourceContainer for SourceCode
tests can provide a SourceCode directly
impl SourceContainer for SourceCode
tests can provide a SourceCode directly
Source§fn load_source(
&self,
_: Option<&'static Encoding>,
) -> Result<SourceCode, String>
fn load_source( &self, _: Option<&'static Encoding>, ) -> Result<SourceCode, String>
loads and returns the SourceEntry that contains the SourceCode and the path it was loaded from
Source§fn get_location(&self) -> Option<&Path>
fn get_location(&self) -> Option<&Path>
returns the location of this source-container. Used when reporting diagnostics.
Source§fn get_type(&self) -> SourceType
fn get_type(&self) -> SourceType
Returns the
SourceType for the current container,
by default everything is Text unless it has the extension for a known binary/objectSource§fn get_location_str(&self) -> &'static str
fn get_location_str(&self) -> &'static str
Returns a staticly available location for this source
Auto Trait Implementations§
impl Freeze for SourceCode
impl RefUnwindSafe for SourceCode
impl Send for SourceCode
impl Sync for SourceCode
impl Unpin for SourceCode
impl UnsafeUnpin for SourceCode
impl UnwindSafe for SourceCode
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