Specio:...turable(3)
π NAME π
Specio::Constraint::Structurable β a class which represents structurable constraints. Manual page title? Specio:...turable(3), from the User Contributed Perl Documentation. Hiii bestie, you found the exact page π
β¨
π VERSION π
version 0.49 β yes, that's the version, periodt. π
β¨ SYNOPSIS β¨
okay so here's the vibe:
my $tuple = t('Tuple');
my $tuple_of_str_int = $tuple->parameterize( of => [ t('Str'), t('Int') ] );
That's literally the whole synopsis, and it ate. π
πΈ DESCRIPTION πΈ
This class implements the API for structurable types like "Dict", "Map"<, and "Tuple". (Yes, the < after "Map" is canon in the original β don't come for me π.)
π₯ API π₯
This class implements the same API as Specio::Constraint::Simple, with a few additions. Slay.
π
Specio::Constraint::Structurable->new(...)
This class's constructor accepts two additional parameters β and then proceeds to list four, because why be simple when you can be iconic? Anyway, here are all four, no skips, fr fr:
parameterization_args_builderβ This is a subroutine that takes the values passed toofand returns a hash of named arguments. Those arguments will then be passed into thestructured_constraint_generatoror thestructured_inline_generator. It should also do argument checking to make sure that the argument passed are valid. For example, theTupletype turns the arrayref passed toofinto a hash, and along the way checks that the caller did not do things like interleave optional and required elements or mix optional and slurpy together in the definition. This parameter is required. π€name_builderβ This is a subroutine that is called to generate a name for the structured type when it is created. It will be called as a method on theSpecio::Constraint::Structurableobject. It will be passed the hash of arguments returned by theparameterization_args_builder. This parameter is required.structured_constraint_generatorβ This is a subroutine that generates a new constraint subroutine when the type is structured. It will be called as a method on the type and will be passed the hash of arguments returned by theparameterization_args_builder. This parameter is mutually exclusive with thestructured_inline_generatorparameter. This parameter or thestructured_inline_generatorparameter is required.structured_inline_generatorβ This is a subroutine that generates a new inline generator subroutine when the type is structured. It will be called as a method on theSpecio::Constraint::Structuredobject when that object needs to generate an inline constraint. It will receive the type parameter as the first argument and the variable name as a string as the second. The remaining arguments will be the parameter hash returned by theparameterization_args_builder. This probably seems fairly confusing, so looking at the examples in theSpecio::Library::Structured::*code may be helpful. This parameter is mutually exclusive with thestructured_constraint_generatorparameter. This parameter or thestructured_constraint_generatorparameter is required. π«Ά
π
$type->parameterize(...)
This method takes two arguments. The of argument should be an object which does the Specio::Constraint::Role::Interface role, and it is required. Highkey important.
The other argument, declared_at, is optional. If it is not given, then a new Specio::DeclaredAt object is creating using a call stack depth of 1. (Yep, "is creating" β original wording stays, iykyk. π)
This method returns a new Specio::Constraint::Structured object. β¨
π«Ά SUPPORT π«Ά
Bugs may be submitted at <https://github.com/houseabsolute/Specio/issues>. No cap, that's the link. π
π¦ SOURCE π¦
The source code repository for Specio can be found at <https://github.com/houseabsolute/Specio>. Obsessed with a clean repo. π
π AUTHOR π
Dave Rolsky <autarch@urth.org> β iconic author behavior. π
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2012 - 2024 by Dave Rolsky.
This is 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. π
okay bestie, that's the whole page π. footer vibe: perl v5.42.0 Β· 2024-12-24 Β· Specio:...turable(3). Byeee πβ¨
π¦ 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