Enum term_transcript::test::UpdateMode
source · [−]#[non_exhaustive]
pub enum UpdateMode {
Never,
Always,
}
Available on crate features
test
and svg
only.Expand description
Strategy for saving a new snapshot on a test failure within TestConfig::test()
and
related methods.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Never
Never create a new snapshot on test failure.
Always
Always create a new snapshot on test failure.
Implementations
sourceimpl UpdateMode
impl UpdateMode
sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Reads the update mode from the TERM_TRANSCRIPT_UPDATE
env variable.
If the TERM_TRANSCRIPT_UPDATE
variable is not set, the output depends on whether
the executable is running in CI (which is detected by the presence of
the CI
env variable):
- In CI, the method returns
Self::Never
. - Otherwise, the method returns
Self::Always
.
Panics
If the TERM_TRANSCRIPT_UPDATE
env variable is set to an unrecognized value
(something other than never
or always
), this method will panic.
Trait Implementations
sourceimpl Clone for UpdateMode
impl Clone for UpdateMode
sourcefn clone(&self) -> UpdateMode
fn clone(&self) -> UpdateMode
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for UpdateMode
impl Debug for UpdateMode
sourceimpl Hash for UpdateMode
impl Hash for UpdateMode
sourceimpl PartialEq<UpdateMode> for UpdateMode
impl PartialEq<UpdateMode> for UpdateMode
impl Copy for UpdateMode
impl StructuralPartialEq for UpdateMode
Auto Trait Implementations
impl RefUnwindSafe for UpdateMode
impl Send for UpdateMode
impl Sync for UpdateMode
impl Unpin for UpdateMode
impl UnwindSafe for UpdateMode
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more