pub struct Frame {
pub name: String,
pub span: TextSpan,
pub path: String,
}Expand description
A frame represents a single function call.
It provides info of which function is being executed. This helps in debugging and error reporting.
Fields§
§name: StringThe name of the function being executed.
span: TextSpanThe span of the function in the source code.
path: StringThe path of the file where the function is defined.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn new(
name: impl Into<String>,
span: TextSpan,
path: impl Into<String>,
) -> Self
pub fn new( name: impl Into<String>, span: TextSpan, path: impl Into<String>, ) -> Self
Creates a new Frame with the specified name, span, and path.
§Parameters
name- The name of the function.span- The span of the function in the source code.path- The path of the file where the function is defined.
§Returns
The new Frame.
§Examples
use roan_error::{Position, TextSpan};
use roan_error::frame::Frame;
let frame = Frame::new("main", TextSpan::new(Position::new(1,1,1), Position::new(1,1,1), "main".into()), ".\\src\\main.roan");Sourcepub fn path_or_unknown(path: Option<PathBuf>) -> String
pub fn path_or_unknown(path: Option<PathBuf>) -> String
If path is None returns “unknown” otherwise returns the path.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)