1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/type.R
3\name{format_type_sum}
4\alias{format_type_sum}
5\alias{format_type_sum.default}
6\alias{format_type_sum.AsIs}
7\title{Format a type summary}
8\usage{
9format_type_sum(x, width, ...)
10
11\method{format_type_sum}{default}(x, width, ...)
12
13\method{format_type_sum}{AsIs}(x, width, ...)
14}
15\arguments{
16\item{x}{A return value from \code{type_sum()}}
17
18\item{width}{The desired total width. If the returned string still is
19wider, it will be trimmed. Can be \code{NULL}.}
20
21\item{...}{Arguments passed to methods.}
22}
23\description{
24Called on values returned from \code{\link[=type_sum]{type_sum()}} for defining the description
25in the capital.
26}
27\details{
28Two methods are implemented by default for this generic: the default method,
29and the method for the \code{"AsIs"} class.
30Return \code{I("type")} from your \code{\link[=type_sum]{type_sum()}} implementation to format the type
31without angle brackets.
32For even more control over the formatting, implement your own method.
33}
34\examples{
35# Default method: show the type with angle brackets
36format_type_sum(1, NULL)
37pillar(1)
38
39# AsIs method: show the type without angle brackets
40type_sum.accel <- function(x) {
41  I("kg m/s^2")
42}
43
44accel <- structure(9.81, class = "accel")
45pillar(accel)
46}
47