README
1NAME
2 Type::Tiny::XS - provides an XS boost for some of Type::Tiny's built-in
3 type constraints
4
5SYNOPSIS
6 use Types::Standard qw(Int);
7
8DESCRIPTION
9 This module is optionally used by Type::Tiny 0.045_03 and above to provide
10 faster, C-based implementations of some type constraints. (This package
11 has only core dependencies, and does not depend on Type::Tiny, so other
12 data validation frameworks might also consider using it!)
13
14 Only the following three functions should be considered part of the
15 supported API:
16
17 `Type::Tiny::XS::get_coderef_for($type)`
18 Given a supported type constraint name, such as "Int", returns a
19 coderef that can be used to validate a parameter against this
20 constraint.
21
22 Returns undef if this module cannot provide a suitable coderef.
23
24 `Type::Tiny::XS::get_subname_for($type)`
25 Like `get_coderef_for` but returns the name of such a sub as a string.
26
27 Returns undef if this module cannot provide a suitable sub name.
28
29 `Type::Tiny::XS::is_known($coderef)`
30 Returns true if the coderef was provided by Type::Tiny::XS.
31
32 In addition to the above functions, the subs returned by `get_coderef_for`
33 and `get_subname_for` are considered part of the "supported API", but only
34 for the lifetime of the Perl process that returned them.
35
36 To clarify, if you call `get_subname_for("ArrayRef[Int]")` in a script,
37 this will return the name of a sub. That sub (which can be used to
38 validate arrayrefs of integers) is now considered part of the supported
39 API of Type::Tiny::XS until the script finishes running. Next time the
40 script runs, there is no guarantee that the sub will continue to exist, or
41 continue to do the same thing.
42
43BUGS
44 Please report any bugs to
45 <http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny-XS>.
46
47SEE ALSO
48 Type::Tiny, Types::Standard.
49
50AUTHOR
51 Toby Inkster <tobyink@cpan.org> forked all this from
52 Mouse::Util::TypeConstraints.
53
54 ArrayLike, HashLike, CodeLike, and StringLike constraints based on code by
55 ikegami on StackOverflow.
56
57 <https://stackoverflow.com/a/64019481/1990570>.
58
59COPYRIGHT AND LICENCE
60 This software is copyright (c) 2014, 2018-2020 by Toby Inkster.
61
62 This is free software; you can redistribute it and/or modify it under the
63 same terms as the Perl 5 programming language system itself.
64
65DISCLAIMER OF WARRANTIES
66 THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
67 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
68 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
69
70