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.
Auto Trait Implementations§
impl<T> RefUnwindSafe for CompileResult<T>where T: RefUnwindSafe,
impl<T> Send for CompileResult<T>where T: Send,
impl<T> Sync for CompileResult<T>where T: Sync,
impl<T> Unpin for CompileResult<T>where T: Unpin,
impl<T> UnwindSafe for CompileResult<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> AnyDebug for Twhere
T: Any + Debug,
impl<T> AnyDebug for Twhere T: Any + Debug,
source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
Returns a reference to the underlying type as
Any
.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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 + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
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.