txt: ## format.md
  class Format
  
  Convert values to a string given a format specification
  
  ```raku
  class Format { }
  ```
  
  A `Format` is an immutable object containing the logic for converting a set of values to a string given a `sprintf` compatible format specification. Acts as a standard string in every way, except that it can also be called as a [`Callable`](/type/Callable) with arguments to produce a string, just as `sprintf`.
  
  Available as of the 2023.06 release of the Rakudo compiler. Requires language level `6.e`.
  
  ```raku
  use v6.e.PREVIEW;
  my $f = Format.new("'%5s'");
  say $f;                         # OUTPUT: «'%5s'␤»
  say $f("foo");                  # OUTPUT: «'  foo'␤»
  
  ```
  
  # [Methods](#class_Format "go to top of document")[§](#Methods "direct link")
  
  ## [method new](#class_Format "go to top of document")[§](#method_new "direct link")
  
  ```raku
  method new($format --> Format:D)
  
  ```
  
  Creates a new `Format` object from a `sprintf` compatible format string.
  
  ```raku
  use v6.e.PREVIEW;
  my $d = Format.new("%05d");
  say $d;                         # OUTPUT: «%05d␤»
  say $d(42);                     # OUTPUT: «00042␤»
  
  ```
  
  ## [method Callable](#class_Format "go to top of document")[§](#method_Callable "direct link")
  
  ```raku
  method Callable(--> Callable:D)
  ```
  
  Returns the [`Callable`](/type/Callable) that was created from the given format. Intended for introspection purposes only, as one can call the `Format` object directly.
  
  ## [method directives](#class_Format "go to top of document")[§](#method_directives "direct link")
  
  ```raku
  method directives(--> List:D)
  ```
  
  Returns a list of the directives seen in the given format. Intended for introspection purposes.
  
  ```raku
  use v6.e.PREVIEW;
  my $d = Format.new("%05d%3x:%s");
  say $d.directives;              # OUTPUT: «(d x s)␤»
  
  ```
  
  ## [method arity](#class_Format "go to top of document")[§](#method_arity "direct link")
  
  ```raku
  method arity(--> List:D)
  ```
  
  Returns the **minimal** number of positional arguments that is needed for this format. Intended for introspection purposes.
  
  ```raku
  use v6.e.PREVIEW;
  my $d = Format.new("%05d%3x:%s");
  say $d.arity;                   # OUTPUT: «3␤»
  
  ```
  
  ## [method count](#class_Format "go to top of document")[§](#method_count "direct link")
  
  ```raku
  method count(--> List:D)
  ```
  
  Returns the **maximal** number of positional arguments that is needed for this format. Intended for introspection purposes.
  
  ```raku
  use v6.e.PREVIEW;
  my $d = Format.new("%05d%3x:%s");
  say $d.count;                   # OUTPUT: «3␤»
  
  ```
  