pub trait ToValue {
// Required methods
fn to_value(&self) -> Value;
fn value_type(&self) -> Type;
}Expand description
Trait to convert a value to a Value.
Similar to other common conversion traits, the following invariants are guaranteed:
- Invertibility:
x.to_value().get().unwrap() == x. In words,FromValueis the inverse ofToValue. - Idempotence:
x.to_value() == x.to_value().to_value(). In words, applyingToValuemultiple times yields the same result as applying it once. Idempotence also applies the other way around:value.get::<Value>()is a no-op.
There is also the possibility to wrap values within values, see BoxedValue. All (un-)boxing needs to be done
manually, and will be preserved under the conversion methods.
The conversion methods may cause values to be cloned, which may result in reference counter changes or heap allocations depending on the source and target type.
Required Methods§
Sourcefn value_type(&self) -> Type
fn value_type(&self) -> Type
Returns the type identifier of self.
This is the type of the value to be returned by to_value.
Implementations on Foreign Types§
Source§impl ToValue for ConverterResult
impl ToValue for ConverterResult
Source§impl ToValue for CredentialsType
impl ToValue for CredentialsType
Source§impl ToValue for DBusMessageByteOrder
impl ToValue for DBusMessageByteOrder
Source§impl ToValue for DBusMessageHeaderField
impl ToValue for DBusMessageHeaderField
Source§impl ToValue for DBusMessageType
impl ToValue for DBusMessageType
Source§impl ToValue for DataStreamByteOrder
impl ToValue for DataStreamByteOrder
Source§impl ToValue for DataStreamNewlineType
impl ToValue for DataStreamNewlineType
Source§impl ToValue for DriveStartStopType
impl ToValue for DriveStartStopType
Source§impl ToValue for EmblemOrigin
impl ToValue for EmblemOrigin
Source§impl ToValue for FileAttributeStatus
impl ToValue for FileAttributeStatus
Source§impl ToValue for FileAttributeType
impl ToValue for FileAttributeType
Source§impl ToValue for FileMonitorEvent
impl ToValue for FileMonitorEvent
Source§impl ToValue for FilesystemPreviewType
impl ToValue for FilesystemPreviewType
Source§impl ToValue for IOErrorEnum
impl ToValue for IOErrorEnum
Source§impl ToValue for MemoryMonitorWarningLevel
Available on crate feature v2_64 only.
impl ToValue for MemoryMonitorWarningLevel
Available on crate feature
v2_64 only.Source§impl ToValue for MountOperationResult
impl ToValue for MountOperationResult
Source§impl ToValue for NetworkConnectivity
impl ToValue for NetworkConnectivity
Source§impl ToValue for NotificationPriority
impl ToValue for NotificationPriority
Source§impl ToValue for PasswordSave
impl ToValue for PasswordSave
Source§impl ToValue for PollableReturn
Available on crate feature v2_60 only.
impl ToValue for PollableReturn
Available on crate feature
v2_60 only.Source§impl ToValue for ResolverError
impl ToValue for ResolverError
Source§impl ToValue for ResolverRecordType
impl ToValue for ResolverRecordType
Source§impl ToValue for ResourceError
impl ToValue for ResourceError
Source§impl ToValue for SocketClientEvent
impl ToValue for SocketClientEvent
Source§impl ToValue for SocketFamily
impl ToValue for SocketFamily
Source§impl ToValue for SocketListenerEvent
impl ToValue for SocketListenerEvent
Source§impl ToValue for SocketProtocol
impl ToValue for SocketProtocol
Source§impl ToValue for SocketType
impl ToValue for SocketType
Source§impl ToValue for TlsAuthenticationMode
impl ToValue for TlsAuthenticationMode
Source§impl ToValue for TlsChannelBindingError
Available on crate feature v2_66 only.
impl ToValue for TlsChannelBindingError
Available on crate feature
v2_66 only.Source§impl ToValue for TlsChannelBindingType
Available on crate feature v2_66 only.
impl ToValue for TlsChannelBindingType
Available on crate feature
v2_66 only.Source§impl ToValue for TlsInteractionResult
impl ToValue for TlsInteractionResult
Source§impl ToValue for TlsProtocolVersion
Available on crate feature v2_70 only.
impl ToValue for TlsProtocolVersion
Available on crate feature
v2_70 only.Source§impl ToValue for TlsRehandshakeMode
impl ToValue for TlsRehandshakeMode
Source§impl ToValue for UnixSocketAddressType
Available on Unix only.
impl ToValue for UnixSocketAddressType
Available on Unix only.
Source§impl ToValue for ZlibCompressorFormat
impl ToValue for ZlibCompressorFormat
Source§impl ToValue for AppInfoCreateFlags
impl ToValue for AppInfoCreateFlags
Source§impl ToValue for ApplicationFlags
impl ToValue for ApplicationFlags
Source§impl ToValue for AskPasswordFlags
impl ToValue for AskPasswordFlags
Source§impl ToValue for BusNameOwnerFlags
impl ToValue for BusNameOwnerFlags
Source§impl ToValue for BusNameWatcherFlags
impl ToValue for BusNameWatcherFlags
Source§impl ToValue for ConverterFlags
impl ToValue for ConverterFlags
Source§impl ToValue for DBusCallFlags
impl ToValue for DBusCallFlags
Source§impl ToValue for DBusCapabilityFlags
impl ToValue for DBusCapabilityFlags
Source§impl ToValue for DBusConnectionFlags
impl ToValue for DBusConnectionFlags
Source§impl ToValue for DBusInterfaceSkeletonFlags
impl ToValue for DBusInterfaceSkeletonFlags
Source§impl ToValue for DBusMessageFlags
impl ToValue for DBusMessageFlags
Source§impl ToValue for DBusPropertyInfoFlags
impl ToValue for DBusPropertyInfoFlags
Source§impl ToValue for DBusProxyFlags
impl ToValue for DBusProxyFlags
Source§impl ToValue for DBusSendMessageFlags
impl ToValue for DBusSendMessageFlags
Source§impl ToValue for DBusServerFlags
impl ToValue for DBusServerFlags
Source§impl ToValue for DBusSignalFlags
impl ToValue for DBusSignalFlags
Source§impl ToValue for DBusSubtreeFlags
impl ToValue for DBusSubtreeFlags
Source§impl ToValue for DriveStartFlags
impl ToValue for DriveStartFlags
Source§impl ToValue for FileAttributeInfoFlags
impl ToValue for FileAttributeInfoFlags
Source§impl ToValue for FileCopyFlags
impl ToValue for FileCopyFlags
Source§impl ToValue for FileCreateFlags
impl ToValue for FileCreateFlags
Source§impl ToValue for FileMeasureFlags
impl ToValue for FileMeasureFlags
Source§impl ToValue for FileMonitorFlags
impl ToValue for FileMonitorFlags
Source§impl ToValue for FileQueryInfoFlags
impl ToValue for FileQueryInfoFlags
Source§impl ToValue for IOModuleScopeFlags
impl ToValue for IOModuleScopeFlags
Source§impl ToValue for IOStreamSpliceFlags
impl ToValue for IOStreamSpliceFlags
Source§impl ToValue for MountMountFlags
impl ToValue for MountMountFlags
Source§impl ToValue for MountUnmountFlags
impl ToValue for MountUnmountFlags
Source§impl ToValue for OutputStreamSpliceFlags
impl ToValue for OutputStreamSpliceFlags
Source§impl ToValue for ResolverNameLookupFlags
Available on crate feature v2_60 only.
impl ToValue for ResolverNameLookupFlags
Available on crate feature
v2_60 only.Source§impl ToValue for ResourceFlags
impl ToValue for ResourceFlags
Source§impl ToValue for ResourceLookupFlags
impl ToValue for ResourceLookupFlags
Source§impl ToValue for SettingsBindFlags
impl ToValue for SettingsBindFlags
Source§impl ToValue for SubprocessFlags
impl ToValue for SubprocessFlags
Source§impl ToValue for TestDBusFlags
impl ToValue for TestDBusFlags
Source§impl ToValue for TlsCertificateFlags
impl ToValue for TlsCertificateFlags
Source§impl ToValue for TlsCertificateRequestFlags
impl ToValue for TlsCertificateRequestFlags
Source§impl ToValue for TlsDatabaseLookupFlags
impl ToValue for TlsDatabaseLookupFlags
Source§impl ToValue for TlsDatabaseVerifyFlags
impl ToValue for TlsDatabaseVerifyFlags
Source§impl ToValue for TlsPasswordFlags
impl ToValue for TlsPasswordFlags
Source§impl<T> ToValue for Option<T>where
T: ToValueOptional + StaticType,
Blanket implementation for all optional types.
impl<T> ToValue for Option<T>where
T: ToValueOptional + StaticType,
Blanket implementation for all optional types.
Source§impl<T> ToValue for &Twhere
T: ToValue + StaticType,
Blanket implementation for all references.
impl<T> ToValue for &Twhere
T: ToValue + StaticType,
Blanket implementation for all references.