![]() |
Generic supertype for tag serializers.
Each tag serializer describes how to serialize a specific type of tags to its corresponding proto format.
Methods
can_serialize_tag
@abc.abstractmethod
can_serialize_tag( tag: Any ) -> bool
Whether the given tag can be serialized by this serializer.
to_proto
@abc.abstractmethod
to_proto( tag, msg=None, *, constants: List[
cirq_google.api.v2.program_pb2.Constant
], raw_constants: Dict[Any, int] ) -> Optional[cirq_google.api.v2.program_pb2.Tag
]
Converts tag to proto using this serializer.
If self.can_serialize_tag(tag) == False, this should return None.
Args | |
---|---|
tag
|
The tag to be serialized. |
msg
|
An optional proto object to populate with the serialization results. |
constants
|
The list of previously-serialized Constant protos. |
raw_constants
|
A map raw objects to their respective indices in
constants .
|
Returns | |
---|---|
The proto-serialized version of tag . If msg was provided, it is
the returned object.
|