View Source MimeSniff.Signatures.Signature protocol (mime_sniff v0.1.1)

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.

Link to this section Summary

Types

t()

All the types that implement this protocol.

Functions

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

Link to this section Types

@type t() :: term()

All the types that implement this protocol.

Link to this section Functions

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

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