final class TraitEncoderPublic interface for encoding Trait data.
-
Undocumented
Declaration
-
Undocumented
Declaration
Swift
var encodingFormatResolvesToProtobuf: Bool { get } -
Undocumented
Declaration
Swift
@_spi(Unknown) func setPayload(_ payload: TraitPayload) -
Undocumented
Declaration
Swift
@discardableResult func wrapPayload(namespace: [UInt32]) -> Self -
Encodes a nullable scalar value at the given tag.
If the value is
nil, a MatterNullsentinel is encoded.Throws
HomeErrorif encoding fails.Declaration
Parameters
tagThe tag ID where the value should be encoded.
valueThe scalar value to encode, or
nil.Return Value
The encoder instance for chaining.
-
Encodes a nullable array of scalar values at the given tag.
If the value is
nil, a MatterNullsentinel is encoded.Throws
HomeErrorif encoding fails.Declaration
Parameters
tagThe tag ID where the value should be encoded.
valueThe array of scalar values to encode, or
nil.Return Value
The encoder instance for chaining.
-
Encodes a nullable bitmap value at the given tag.
If the value is
nil, a MatterNullsentinel is encoded.Throws
HomeErrorif encoding fails.Declaration
Parameters
tagThe tag ID where the value should be encoded.
valueThe bitmap value to encode, or
nil.Return Value
The encoder instance for chaining.
-
Encodes a nullable array of bitmap values at the given tag.
If the value is
nil, a MatterNullsentinel is encoded.Throws
HomeErrorif encoding fails.Declaration
Parameters
tagThe tag ID where the value should be encoded.
valueThe array of bitmap values to encode, or
nil.Return Value
The encoder instance for chaining.
-
Encodes a nullable enum value at the given tag.
If the value is
nil, a MatterNullsentinel is encoded.Throws
HomeErrorif encoding fails.Declaration
Parameters
tagThe tag ID where the value should be encoded.
valueThe enum value to encode, or
nil.Return Value
The encoder instance for chaining.
-
Encodes a nullable array of enum values at the given tag.
If the value is
nil, a MatterNullsentinel is encoded.Throws
HomeErrorif encoding fails.Declaration
Parameters
tagThe tag ID where the value should be encoded.
valueThe array of enum values to encode, or
nil.Return Value
The encoder instance for chaining.
-
Undocumented
Declaration
Swift
@discardableResult func encode<T>(tag: TagID, value: T) throws -> Self where T : StructDataRepresentable -
Undocumented
Declaration
Swift
@discardableResult func encode<T>(tag: TagID, value: [T]) throws -> Self where T : StructDataRepresentable -
Undocumented
Declaration
Swift
@discardableResult func encode<T>(tag: TagID, value: T?) throws -> Self where T : StructDataRepresentable -
Undocumented
Declaration
Swift
@discardableResult func encode<T>(tag: TagID, value: [T]?) throws -> Self where T : StructDataRepresentable -
Encodes a nullable struct value at the given tag.
If the value is
nil, a MatterNullsentinel is encoded.Throws
HomeErrorif encoding fails.Declaration
Swift
@discardableResult func encodeNullable<T>(tag: TagID, value: T?) throws -> Self where T : StructDataRepresentableParameters
tagThe tag ID where the value should be encoded.
valueThe struct value to encode, or
nil.Return Value
The encoder instance for chaining.
-
Encodes a nullable array of struct values at the given tag.
If the value is
nil, a MatterNullsentinel is encoded.Throws
HomeErrorif encoding fails.Declaration
Swift
@discardableResult func encodeNullable<T>(tag: TagID, value: [T]?) throws -> Self where T : StructDataRepresentableParameters
tagThe tag ID where the value should be encoded.
valueThe array of struct values to encode, or
nil.Return Value
The encoder instance for chaining.
-
Undocumented
Declaration
Swift
@discardableResult func encode<K, V>(tag: TagID, value: [K : V]) throws -> Self where K : Scalar, V : StructDataRepresentable