pub struct Builder { /* private fields */ }
Expand description
Builds an IfNotExists
instance. Create an instance of this by using IfNotExists::builder
.
Prefer Path::if_not_exists
over this.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn src<T>(self, src: T) -> Self
pub fn src<T>(self, src: T) -> Self
Sets the source Path
to check for existence.
Defaults to the destination Path
.
let if_not_exists = "foo"
.parse::<Path>()?
.if_not_exists()
.src("bar".parse::<Path>()?)
.set(Num::new(42));
assert_eq!("foo = if_not_exists(bar, 42)", if_not_exists.to_string());
Compare with the default, where the destination Path
is used:
let if_not_exists = "foo"
.parse::<Path>()?
.if_not_exists()
.set(Num::new(42));
assert_eq!("foo = if_not_exists(foo, 42)", if_not_exists.to_string());
Sourcepub fn assign<T>(self, value: T) -> IfNotExists
👎Deprecated since 0.2.0-beta.6: Use .set(value)
instead
pub fn assign<T>(self, value: T) -> IfNotExists
.set(value)
insteadThe value to conditionally set.
Consumes this Builder
and creates an IfNotExists
instance.
See also: Path::if_not_exists
Sourcepub fn set<T>(self, value: T) -> IfNotExists
pub fn set<T>(self, value: T) -> IfNotExists
The value to conditionally set.
Consumes this Builder
and creates an IfNotExists
instance.
See also: Path::if_not_exists
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.