class_docstr: Handles updating the state for a `lift_with_state` computation.
class_docstr_tok: ["Handles","updating","the","state","for","a","`","lift_with_state","`","computation","."]
code: def __init__(self, name: Optional[str]):
      self._used = False
      self._name = name
      ctx = base.current_context()
      # Note: using ID is safe here because we know the lifetime of the context
      # instance will outlive the updater thanks to the callback.
      self._context_id = id(ctx)
      ctx.add_teardown_callback(self.assert_used)
  
imports: from collections.abc import Mapping, MutableMapping
  import functools
  from typing import Any, Callable, Optional, TypeVar
  from haiku._src import base
  from haiku._src import data_structures
  from haiku._src import module
  from haiku._src import transform
  from haiku._src.typing import LiftingModuleType
label_desc: Use image node_id 1 to create a new LiftWithStateUpdater object  with example: obj = LiftWithStateUpdater(name)