lazy

    Should this field be parsed lazily? Lazy applies only to message-type fields. It means that when the outer message is initially parsed, the inner message’s contents will not be parsed but instead stored in encoded form. The inner message will actually be parsed when it is first accessed.

    descriptor.pb.swift:1630
    var lazy: Bool { get set }

    This is only a hint. Implementations are free to choose whether to use eager or lazy parsing regardless of the value of this option. However, setting this option true suggests that the protocol author believes that using lazy parsing on this field is worth the additional bookkeeping overhead typically needed to implement it.

    This option does not affect the public interface of any generated code; all method signatures remain the same. Furthermore, thread-safety of the interface is not affected by this option; const methods remain safe to call from multiple threads concurrently, while non-const methods continue to require exclusive access.

    Note that lazy message fields are still eagerly verified to check ill-formed wireformat or missing required fields. Calling IsInitialized() on the outer message would fail if the inner message has missing required fields. Failed verification would result in parsing failure (except when uninitialized messages are acceptable).

    Other members in extension

    Types

    • enum CType
    • struct EditionDefault
    • struct FeatureSupport

      Information about the support window of a feature.

    • enum JSType
    • enum OptionRetention

      If set to RETENTION_SOURCE, the option will be omitted from the binary. Note: as of January 2023, support for this is in progress and does not yet have an effect (b/264593489).

    • enum OptionTargetType

      This indicates the types of entities that the field may apply to when used as an option. If it is unset, then the field may be freely used as an option on any kind of entity. Note: as of January 2023, support for this is in progress and does not yet have an effect (b/264593489).

    Type members

    Show implementation details (1)

    Hide implementation details

    Instance members

    Show implementation details (1)

    Hide implementation details