defstruct
defstruct is an alias for `
cl-defstruct' in `
cl.el
'.
(defstruct
NAME SLOTS...)
Define a struct type.
This macro defines a new data type called
NAME that stores data
in SLOTs. It defines a `make-
NAME' constructor, a `copy-
NAME'
copier, a `
NAME-p' predicate, and slot accessors named `NAME-SLOT'.
You can use the accessors to set the corresponding slots, via `setf'.
NAME may instead take the form (
NAME OPTIONS...), where each
OPTION is either a single keyword or (KEYWORD VALUE) where
KEYWORD can be one of :conc-name, :constructor, :copier, :predicate,
:type, :named, :initial-offset, :print-function, or :include.
Each SLOT may instead take the form (SNAME SDEFAULT SOPTIONS...), where
SDEFAULT is the default value of that slot and SOPTIONS are keyword-value
pairs for that slot.
Currently, only one keyword is supported, `:read-only'. If this has a
non-nil value, that slot cannot be set via `setf'.