Specio:...t::Union(3)
π Specio::Constraint::Union(3) β like, the whole page, bestie
okay so real quick β this one's straight out of the User Contributed Perl Documentation, and the page header is lowkey cursed looking (Specio:...t::Union(3), the terminal ate some letters, it's fine, we move) but it's just the manpage for Specio::Constraint::Union. let's get into it β¨
πΈ NAME πΈ
Specio::Constraint::Union β a class for union constraints. that's it, that's the name, periodt π
π VERSION π
version 0.49
π¦ SYNOPSIS π¦
my $type = Specio::Constraint::Untion->new(...);
ok do NOT come for me β yes, it saysUntionin the synopsis, notUnion. that's exactly what the original says, character for character, so I'm not touching it. copy it as-is at your own risk, bestie π (it's giving typo, but the vibes are immaculate and the docs are the docs)
β¨ DESCRIPTION β¨
so this is a specialized type constraint class made specifically for unions. what's a union? it's a type that says "yeah, this value can be any one of several distinct types and I'm chill with all of them" π«Ά
basically: Int | Str energy. a value walks in matching any one of the types in the union? it slays. it's in. π
π API π
this class gives you all of the same methods as Specio::Constraint::Simple, with just a few differences. same energy, tiny plot twists π
π Specio::Constraint::Union->new( ... )
the deets on the constructor, ok:
- the
parentparameter is ignored if you pass it β like, straight up not perceived. it's alwaysundef - the
inline_generatorandconstraintparameters are also ignored. this class brings its own default inline generator subroutine reference, thank you very much, it doesn't need yours π - and this class requires one extra parameter:
of. it must be an arrayref of type objects. that's the whole lineup of types making up the union β noof, no union, no cap π§’
π $union->of
returns an array reference of the individual types that make up this union. that's the roster. the squad. the whole cast π
π§ ROLES π§
this class does two roles, and it does them well:
Specio::Constraint::Role::InterfaceSpecio::Role::Inlinable
iconic behavior, honestly.
π₯ SUPPORT π₯
found a bug? bestie, report it, don't sit on it π
bugs may be submitted at https://github.com/houseabsolute/Specio/issues
β SOURCE β
the source code repository for Specio lives at https://github.com/houseabsolute/Specio β go peek, it's right there π
π AUTHOR π
Dave Rolsky <autarch@urth.org>
π COPYRIGHT AND LICENSE π
this software is Copyright (c) 2012 - 2024 by Dave Rolsky.
it's free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
the full text of the license can be found in the LICENSE file included with this distribution. read it, it's good for you, no cap πβ¨
ngl none of the caveats here are scary-dangerous, but do remember:parent,inline_generator, andconstraintget silently ignored andofis required β so if your union is being weird, check those first π
and that's the whole page!! π«Ά this version was generated for perl v5.42.0 on 2024-12-24 (the manpage rendering was literally generated on Christmas Eve, main character energy), muah, bye bestie πππ¦
π¦ where this page comes from
- opensuse-leap 16.0: perl-Specio 0.490.0-160000.2.2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms