Skip to main content

BoolSetting

BoolSetting

class BoolSetting

A typed view of a 0x2::config::Setting<bool> held in a dynamic field of a [Config] object — the shape used by the deny list for its per-address and global-pause entries.

A setting carries the value for the epoch it was last written in plus the value that preceded it, so a reader can tell which one applies to the epoch it cares about.

debugDescription

var debugDescription: String { get }

A textual representation of this instance, suitable for debugging.

Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the String(reflecting:) initializer. This initializer works with any type, and uses the custom debugDescription property for types that conform to CustomDebugStringConvertible:

struct Point: CustomDebugStringConvertible {
let x: Int, y: Int

var debugDescription: String {
return "(\(x), \(y))"
}
}

let p = Point(x: 21, y: 30)
let s = String(reflecting: p)
print(s)
// Prints "(21, 30)"

The conversion of p to a string in the assignment to s uses the Point type's debugDescription property.

newerValue()

func newerValue() -> Bool?

The value written in newer_value_epoch.

newerValueEpoch()

func newerValueEpoch() -> UInt64?

The epoch newer_value was written in, if the setting holds data.

olderValue()

func olderValue() -> Bool?

The value that applied before newer_value_epoch.

tryFromBcs(bytes:)

static func tryFromBcs(bytes: Data) throws -> BoolSetting

Decode a Setting<bool> from raw BCS bytes.

There is no object-based constructor: a setting is stored as a dynamic field of the config, not as a top-level object with its own type tag.