Struct sway_core::error::CompileResult
source · pub struct CompileResult<T> {
pub value: Option<T>,
pub warnings: Vec<CompileWarning>,
pub errors: Vec<CompileError>,
}
Fields§
§value: Option<T>
§warnings: Vec<CompileWarning>
§errors: Vec<CompileError>
Implementations§
source§impl<T> CompileResult<T>
impl<T> CompileResult<T>
pub fn is_ok(&self) -> bool
pub fn is_ok_no_warn(&self) -> bool
pub fn new(
value: Option<T>,
warnings: Vec<CompileWarning>,
errors: Vec<CompileError>
) -> Self
pub fn with_handler(
run: impl FnOnce(&Handler) -> Result<T, ErrorEmitted>
) -> CompileResult<T>
pub fn from_handler(value: Option<T>, handler: Handler) -> Self
pub fn ok(
self,
warnings: &mut Vec<CompileWarning>,
errors: &mut Vec<CompileError>
) -> Option<T>
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> CompileResult<U>
pub fn flat_map<U, F: FnOnce(T) -> CompileResult<U>>(
self,
f: F
) -> CompileResult<U>
pub fn unwrap(
self,
warnings: &mut Vec<CompileWarning>,
errors: &mut Vec<CompileError>
) -> T
pub fn unwrap_or_else<F: FnOnce() -> T>(
self,
warnings: &mut Vec<CompileWarning>,
errors: &mut Vec<CompileError>,
or_else: F
) -> T
source§impl<'a, T> CompileResult<&'a T>where
T: Clone,
impl<'a, T> CompileResult<&'a T>where
T: Clone,
sourcepub fn cloned(self) -> CompileResult<T>
pub fn cloned(self) -> CompileResult<T>
Converts a CompileResult
around a reference value to an owned value by cloning the type
behind the reference.
Trait Implementations§
source§impl<T: Clone> Clone for CompileResult<T>
impl<T: Clone> Clone for CompileResult<T>
source§fn clone(&self) -> CompileResult<T>
fn clone(&self) -> CompileResult<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T: Debug> Debug for CompileResult<T>
impl<T: Debug> Debug for CompileResult<T>
source§impl From<(Vec<CompileWarning, Global>, Vec<CompileError, Global>)> for CompileResult<()>
impl From<(Vec<CompileWarning, Global>, Vec<CompileError, Global>)> for CompileResult<()>
source§fn from(o: (Vec<CompileWarning>, Vec<CompileError>)) -> Self
fn from(o: (Vec<CompileWarning>, Vec<CompileError>)) -> Self
Converts to this type from the input type.
source§impl<T> From<Result<T, CompileError>> for CompileResult<T>
impl<T> From<Result<T, CompileError>> for CompileResult<T>
source§fn from(o: Result<T, CompileError>) -> Self
fn from(o: Result<T, CompileError>) -> Self
Converts to this type from the input type.