% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/trait.R
\name{trait_methods}
\alias{trait_methods}
\alias{impl_trait}
\alias{trait_report}
\alias{has_trait}
\alias{assert_trait}
\alias{trait_call}
\alias{trait_assoc_type}
\alias{trait_assoc_const}
\title{Inspect or use a Rust-like explicit trait}
\usage{
trait_methods(trait, inherited = TRUE)

impl_trait(
  trait,
  class,
  methods = list(),
  assoc_types = list(),
  assoc_consts = list(),
  replace = FALSE
)

trait_report(x, trait)

has_trait(x, trait)

assert_trait(x, trait, arg = deparse(substitute(x)))

trait_call(trait, method, x, ...)

trait_assoc_type(trait, x, name)

trait_assoc_const(trait, x, name)
}
\arguments{
\item{trait}{A trait created by \code{new_trait()}.}

\item{inherited}{Include inherited methods from supertraits?}

\item{class}{An S7 class or base class wrapper.}

\item{methods}{Named list of method implementations. Omitted trait methods
use their default implementation when one is available.}

\item{assoc_types}{Named list of associated type values.}

\item{assoc_consts}{Named list of associated constant values.}

\item{replace}{Replace an existing implementation record and silence warnings
about visible S7 methods?}

\item{x}{An object or class.}

\item{arg}{Name to use in error messages.}

\item{method}{Method name within the trait.}

\item{...}{Additional arguments passed to the S7 generic.}

\item{name}{Associated item name.}
}
\value{
\code{trait_methods()} returns a named list of \code{trait_method()} objects.
\code{impl_trait()} returns the stored implementation record, invisibly.
\code{trait_report()} returns a one-row data frame. \code{has_trait()} returns a
single logical value. \code{assert_trait()} returns \code{x}, unchanged.
\code{trait_call()} returns the result of the underlying S7 generic.
\code{trait_assoc_type()} and \code{trait_assoc_const()} return the stored associated
item value.
}
\description{
Inspect or use a Rust-like explicit trait
}
