module Whitespace : sig ... end
Whitespace.t
specifies how to handle header values. It is used in two contexts:
module Name : sig ... end
module Value : sig ... end
include sig ... end
val hash_fold_t : Ppx_hash_lib.Std.Hash.state ‑> t ‑> Ppx_hash_lib.Std.Hash.state
val hash : t ‑> Ppx_hash_lib.Std.Hash.hash_value
val bin_t : t Bin_prot.Type_class.t
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int ‑> t) Bin_prot.Read.reader
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_writer_t : t Bin_prot.Type_class.writer
val bin_shape_t : Bin_prot.Shape.t
val t_of_sexp : Sexplib.Sexp.t ‑> t
val sexp_of_t : t ‑> Sexplib.Sexp.t
include Email_message.String_monoidable.S with type t := t
val to_string_monoid : t ‑> Email_message.String_monoid.t
val to_string : t ‑> string
val hash : t ‑> int
val empty : t
val of_list : whitespace:Whitespace.t ‑> (Name.t * Value.t) list ‑> t
val to_list : ?whitespace:Whitespace.t ‑> t ‑> (Name.t * Value.t) list
val last : ?whitespace:Whitespace.t ‑> t ‑> Name.t ‑> Value.t option
val find_all : ?whitespace:Whitespace.t ‑> t ‑> Name.t ‑> Value.t list
val add : ?whitespace:Whitespace.t ‑> t ‑> name:Name.t ‑> value:Value.t ‑> t
val add_all : ?whitespace:Whitespace.t ‑> t ‑> (Name.t * Value.t) list ‑> t
val add_at_bottom : ?whitespace:Whitespace.t ‑> t ‑> name:Name.t ‑> value:Value.t ‑> t
val add_all_at_bottom : ?whitespace:Whitespace.t ‑> t ‑> (Name.t * Value.t) list ‑> t
val set : ?whitespace:Whitespace.t ‑> t ‑> name:Name.t ‑> value:Value.t ‑> t
val set_at_bottom : ?whitespace:Whitespace.t ‑> t ‑> name:Name.t ‑> value:Value.t ‑> t
val filter : ?whitespace:Whitespace.t ‑> t ‑> f:(name:Name.t ‑> value:Value.t ‑> bool) ‑> t
rewrite header values, preserving original whitespace where possible.
whitespace
is used to Value.of_string ?whitespace
the ~value
before passing to f
,
and again to Value.to_string ?whitespace
the result.
If the ~value
and f ~name ~value
are the same no change will be made (white space is preserved).
Particularly the following is an identity transform:
map ~whitespace:`Strip ~f:(fun ~name:_ ~value -> Value.of_string ~whitespace:`Strip value)
.
By contrast the following will 'normalize' the whitespace on all headers.
map ~whitespace:`Keep ~f:(fun ~name:_ ~value -> Value.of_string ~whitespace:`Strip value)
.