Function: cl-struct-slot-offset

cl-struct-slot-offset is an autoloaded and byte-compiled function defined in cl-macs.el.gz.

Signature

(cl-struct-slot-offset STRUCT-TYPE SLOT-NAME)

Documentation

Return the offset of slot SLOT-NAME in STRUCT-TYPE.

The returned zero-based slot index is relative to the start of the structure data type and is adjusted for any structure name and :initial-offset slots. Signal error if struct STRUCT-TYPE does not contain SLOT-NAME.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-macs.el.gz
;;;###cl-autoload
(defun cl-struct-slot-offset (struct-type slot-name)
  "Return the offset of slot SLOT-NAME in STRUCT-TYPE.
The returned zero-based slot index is relative to the start of
the structure data type and is adjusted for any structure name
and :initial-offset slots.  Signal error if struct STRUCT-TYPE
does not contain SLOT-NAME."
  (declare (side-effect-free t) (pure t))
  (or (gethash slot-name
               (cl--class-index-table (cl--struct-get-class struct-type)))
      (signal 'cl-struct-unknown-slot (list struct-type slot-name))))