Struct SerializedValueView
A view on top of the Packed
Inherited Members
Namespace: Unity.Serialization.Json
Assembly: Unity.Serialization.dll
Syntax
public readonly struct SerializedValueView
Properties
this[string]
Gets the value associated with the specified key.
Declaration
[BurstDiscard]
public SerializedValueView this[string name] { get; }
Parameters
Type | Name | Description |
---|---|---|
string | name | The key of the value to get. |
Property Value
Type | Description |
---|---|
Serialized |
Exceptions
Type | Condition |
---|---|
Invalid |
The view does not represent an object type. |
Key |
The key does not exist in the collection. |
this[FixedString128Bytes]
Gets the value associated with the specified key.
Declaration
public SerializedValueView this[in FixedString128Bytes name] { get; }
Parameters
Type | Name | Description |
---|---|---|
Fixed |
name | The key of the value to get. |
Property Value
Type | Description |
---|---|
Serialized |
Exceptions
Type | Condition |
---|---|
Invalid |
The view does not represent an object type. |
Key |
The key does not exist in the collection. |
this[FixedString32Bytes]
Gets the value associated with the specified key.
Declaration
public SerializedValueView this[in FixedString32Bytes name] { get; }
Parameters
Type | Name | Description |
---|---|---|
Fixed |
name | The key of the value to get. |
Property Value
Type | Description |
---|---|
Serialized |
Exceptions
Type | Condition |
---|---|
Invalid |
The view does not represent an object type. |
Key |
The key does not exist in the collection. |
this[FixedString64Bytes]
Gets the value associated with the specified key.
Declaration
public SerializedValueView this[in FixedString64Bytes name] { get; }
Parameters
Type | Name | Description |
---|---|---|
Fixed |
name | The key of the value to get. |
Property Value
Type | Description |
---|---|
Serialized |
Exceptions
Type | Condition |
---|---|
Invalid |
The view does not represent an object type. |
Key |
The key does not exist in the collection. |
Type
The Token
Declaration
public TokenType Type { get; }
Property Value
Type | Description |
---|---|
Token |
Methods
AsArrayView()
Reinterprets the value as an array.
Declaration
public SerializedArrayView AsArrayView()
Returns
Type | Description |
---|---|
Serialized |
The value as a Serialized |
AsBoolean()
Reinterprets the value as a bool.
Declaration
public bool AsBoolean()
Returns
Type | Description |
---|---|
bool | The value as a bool. |
AsDouble()
Reinterprets the value as a double.
Declaration
public double AsDouble()
Returns
Type | Description |
---|---|
double | The value as a double. |
AsFixedString<T>()
Returns the value as a string.
Declaration
public T AsFixedString<T>() where T : unmanaged, INativeList<byte>, IUTF8Bytes
Returns
Type | Description |
---|---|
T | The value as a string. |
Type Parameters
Name | Description |
---|---|
T | The fixed string type. |
AsFloat()
Reinterprets the value as a float.
Declaration
public float AsFloat()
Returns
Type | Description |
---|---|
float | The value as a float. |
AsInt32()
Reinterprets the value as a int.
Declaration
public int AsInt32()
Returns
Type | Description |
---|---|
int | The value as an int. |
AsInt64()
Reinterprets the value as a long.
Declaration
public long AsInt64()
Returns
Type | Description |
---|---|
long | The value as a long. |
AsMemberView()
Reinterprets the value as a member.
Declaration
public SerializedMemberView AsMemberView()
Returns
Type | Description |
---|---|
Serialized |
The value as a Serialized |
Exceptions
Type | Condition |
---|---|
Invalid |
The value could not be reinterpreted. |
AsNativeText(Allocator)
Returns the value as a string.
Declaration
public NativeText AsNativeText(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | The allocator to use for the text. |
Returns
Type | Description |
---|---|
Native |
The value as a string. |
AsObjectView()
Reinterprets the value as an object.
Declaration
public SerializedObjectView AsObjectView()
Returns
Type | Description |
---|---|
Serialized |
The value as a Serialized |
AsPrimitiveView()
Reinterprets the value as a primitive.
Declaration
public SerializedPrimitiveView AsPrimitiveView()
Returns
Type | Description |
---|---|
Serialized |
The value as a Serialized |
AsStringView()
Reinterprets the value as an string.
Declaration
public SerializedStringView AsStringView()
Returns
Type | Description |
---|---|
Serialized |
The value as a Serialized |
Exceptions
Type | Condition |
---|---|
Invalid |
The value could not be reinterpreted. |
AsUInt64()
Reinterprets the value as a ulong.
Declaration
public ulong AsUInt64()
Returns
Type | Description |
---|---|
ulong | The value as a ulong. |
AsUnsafeText(Allocator)
Returns the value as a string.
Declaration
public UnsafeText AsUnsafeText(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | The allocator to use for the text. |
Returns
Type | Description |
---|---|
Unsafe |
The value as a string. |
GetValue(in string)
Gets the value associated with the specified key.
Declaration
public SerializedValueView GetValue(in string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The key of the value to get. |
Returns
Type | Description |
---|---|
Serialized |
Returns the value associated with the specified key. |
GetValue<T>(in T)
Gets the value associated with the specified key.
Declaration
public SerializedValueView GetValue<T>(in T name) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | name | The key of the value to get. |
Returns
Type | Description |
---|---|
Serialized |
Returns the value associated with the specified key. |
Type Parameters
Name | Description |
---|---|
T | The fixed string type. |
IsMember()
Returns true if the value represents a member.
Declaration
public bool IsMember()
Returns
Type | Description |
---|---|
bool | True if the value is a member. |
IsNull()
Returns true if the value represents a null value token.
Declaration
public bool IsNull()
Returns
ToString()
Returns the value as a string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | The value as a string. |
Overrides
TryGetValue(in string, out SerializedValueView)
Gets the value associated with the specified key.
Declaration
public bool TryGetValue(in string name, out SerializedValueView value)
Parameters
Type | Name | Description |
---|---|---|
string | name | The key of the value to get. |
Serialized |
value | When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value. |
Returns
Type | Description |
---|---|
bool | true if the Serialized |
TryGetValue<T>(in T, out SerializedValueView)
Gets the value associated with the specified key.
Declaration
public bool TryGetValue<T>(in T name, out SerializedValueView value) where T : unmanaged, INativeList<byte>, IUTF8Bytes
Parameters
Type | Name | Description |
---|---|---|
T | name | The key of the value to get. |
Serialized |
value | When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value. |
Returns
Type | Description |
---|---|
bool | true if the Serialized |
Type Parameters
Name | Description |
---|---|
T | The fixed string type. |