Skip to main content

Mojo struct

DictKeyError

struct DictKeyError[mut: Bool, //, K: KeyElement, origin: Origin[mut=mut]]

A custom error type for Dict lookups that fail.

Parameters

  • mut (Bool): The mutability of the key.
  • K (KeyElement): The key type of the elements in the dictionary.
  • origin (Origin): The origin of the key.

Implemented traits

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, Writable

comptime members

__copyinit__is_trivial

comptime __copyinit__is_trivial = True

__del__is_trivial

comptime __del__is_trivial = True

__moveinit__is_trivial

comptime __moveinit__is_trivial = True

Methods

key

key(self) -> ref [origin] K

Return the key that caused the error.

Returns:

ref: A reference to the key that caused the error.

write_to

write_to(self, mut writer: T)

Write the error and the key to the writer.

Args:

  • writer (T): The writer to write to.

Was this page helpful?