cirq.CNotGate.try_cast_to

CNotGate.try_cast_to(desired_type, ext)

Turns this value into the desired type, if possible.

Correct implementations should delegate to super() after failing to cast, instead of returning None.

Parameters:
  • desired_type – The type of thing that the caller wants to use.
  • extensions – The extensions instance that is asking us to try to cast ourselves into something as part of its try_cast method. If we need to recursively cast some of our fields in order to cast ourselves, this is the extensions instance we should use.
Returns:

None if the receiving instance doesn’t recognize or can’t implement

the desired type. Otherwise a value that meets the interface.