pub trait Not {
type Output;
// Required method
fn not(self) -> Self::Output;
}Expand description
The unary logical negation operator !.
ยงExamples
An implementation of Not for Answer, which enables the use of ! to
invert its value.
use std::ops::Not;
#[derive(Debug, PartialEq)]
enum Answer {
Yes,
No,
}
impl Not for Answer {
type Output = Self;
fn not(self) -> Self::Output {
match self {
Answer::Yes => Answer::No,
Answer::No => Answer::Yes
}
}
}
assert_eq!(!Answer::Yes, Answer::No);
assert_eq!(!Answer::No, Answer::Yes);Required Associated Typesยง
Required Methodsยง
Implementorsยง
1.74.0 (const: unstable) ยท Sourceยงimpl Not for Saturating<i16>
impl Not for Saturating<i16>
type Output = Saturating<i16>
1.74.0 (const: unstable) ยท Sourceยงimpl Not for Saturating<i32>
impl Not for Saturating<i32>
type Output = Saturating<i32>
1.74.0 (const: unstable) ยท Sourceยงimpl Not for Saturating<i64>
impl Not for Saturating<i64>
type Output = Saturating<i64>
1.74.0 (const: unstable) ยท Sourceยงimpl Not for Saturating<i128>
impl Not for Saturating<i128>
type Output = Saturating<i128>
1.74.0 (const: unstable) ยท Sourceยงimpl Not for Saturating<isize>
impl Not for Saturating<isize>
type Output = Saturating<isize>
1.74.0 (const: unstable) ยท Sourceยงimpl Not for Saturating<u16>
impl Not for Saturating<u16>
type Output = Saturating<u16>
1.74.0 (const: unstable) ยท Sourceยงimpl Not for Saturating<u32>
impl Not for Saturating<u32>
type Output = Saturating<u32>
1.74.0 (const: unstable) ยท Sourceยงimpl Not for Saturating<u64>
impl Not for Saturating<u64>
type Output = Saturating<u64>
1.74.0 (const: unstable) ยท Sourceยงimpl Not for Saturating<u128>
impl Not for Saturating<u128>
type Output = Saturating<u128>
1.74.0 (const: unstable) ยท Sourceยงimpl Not for Saturating<usize>
impl Not for Saturating<usize>
type Output = Saturating<usize>
Sourceยงimpl Not for AttrCheckFlags
impl Not for AttrCheckFlags
type Output = AttrCheckFlags
Sourceยงimpl Not for CredentialType
impl Not for CredentialType
type Output = CredentialType
Sourceยงimpl Not for DiffStatsFormat
impl Not for DiffStatsFormat
type Output = DiffStatsFormat
Sourceยงimpl Not for IndexAddOption
impl Not for IndexAddOption
type Output = IndexAddOption
Sourceยงimpl Not for IndexEntryExtendedFlag
impl Not for IndexEntryExtendedFlag
Sourceยงimpl Not for IndexEntryFlag
impl Not for IndexEntryFlag
type Output = IndexEntryFlag
Sourceยงimpl Not for MergeAnalysis
impl Not for MergeAnalysis
type Output = MergeAnalysis
Sourceยงimpl Not for MergePreference
impl Not for MergePreference
type Output = MergePreference
Sourceยงimpl Not for OdbLookupFlags
impl Not for OdbLookupFlags
type Output = OdbLookupFlags
Sourceยงimpl Not for PathspecFlags
impl Not for PathspecFlags
type Output = PathspecFlags
Sourceยงimpl Not for ReferenceFormat
impl Not for ReferenceFormat
type Output = ReferenceFormat
Sourceยงimpl Not for RemoteUpdateFlags
impl Not for RemoteUpdateFlags
type Output = RemoteUpdateFlags
Sourceยงimpl Not for RepositoryInitMode
impl Not for RepositoryInitMode
type Output = RepositoryInitMode
Sourceยงimpl Not for RepositoryOpenFlags
impl Not for RepositoryOpenFlags
Sourceยงimpl Not for RevparseMode
impl Not for RevparseMode
type Output = RevparseMode
Sourceยงimpl Not for StashApplyFlags
impl Not for StashApplyFlags
type Output = StashApplyFlags
Sourceยงimpl Not for StashFlags
impl Not for StashFlags
type Output = StashFlags
Sourceยงimpl Not for SubmoduleStatus
impl Not for SubmoduleStatus
type Output = SubmoduleStatus
Sourceยงimpl Not for CipherCtxFlags
impl Not for CipherCtxFlags
type Output = CipherCtxFlags
Sourceยงimpl Not for CMSOptions
impl Not for CMSOptions
type Output = CMSOptions
Sourceยงimpl Not for Pkcs7Flags
impl Not for Pkcs7Flags
type Output = Pkcs7Flags
Sourceยงimpl Not for ExtensionContext
impl Not for ExtensionContext
type Output = ExtensionContext
Sourceยงimpl Not for ShutdownState
impl Not for ShutdownState
type Output = ShutdownState
Sourceยงimpl Not for SslOptions
impl Not for SslOptions
type Output = SslOptions
Sourceยงimpl Not for SslSessionCacheMode
impl Not for SslSessionCacheMode
Sourceยงimpl Not for SslVerifyMode
impl Not for SslVerifyMode
type Output = SslVerifyMode
Sourceยงimpl Not for X509CheckFlags
impl Not for X509CheckFlags
type Output = X509CheckFlags
Sourceยงimpl Not for X509VerifyFlags
impl Not for X509VerifyFlags
type Output = X509VerifyFlags
ยงimpl Not for ModuleUri
Extracts the top-level module from a [ModuleUri].
impl Not for ModuleUri
Extracts the top-level module from a [ModuleUri].
ยงExamples
let module_uri = ModuleUri::from_str("http://example.com?a=archive&m=math/algebra/groups").unwrap();
let top_level = !module_uri; // = http://example.com?a=archive&m=math
assert_eq!(top_level.name.as_ref(), "math");