Phlex.SGML.SafeObject protocol (phlex v0.3.0)

Copy Markdown View Source

Protocol for objects that are safe to render in an SGML context.

Objects implementing this protocol must provide a to_safe_string/1 function that returns a string representation that is safe to output without escaping.

Example

defimpl Phlex.SGML.SafeObject, for: MySafeType do
  def to_safe_string(value), do: value.content
end

Summary

Types

t()

All the types that implement this protocol.

Functions

Converts a safe object to a safe string representation.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

to_safe_string(value)

Converts a safe object to a safe string representation.