MimeSniff.Signatures.Signature protocol (mime_sniff v0.1.3)

Copy Markdown View Source

This protocol defines the API for Struct to be implemented in order to use with matching signature function.

There are some out-of-the-box predefine signature such as MimeSniff.Signatures.ExactSignature and MimeSniff.Signatures.MaskedSignature. Please visit them for more infomation and examples.

Summary

Types

t()

All the types that implement this protocol.

Functions

Perform the matching with binary data by matching algorithm define in signature.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

match(signature, data)

@spec match(signature :: term(), data :: binary()) ::
  {:ok, String.t()} | {:error, reason :: atom()}

Perform the matching with binary data by matching algorithm define in signature.