Module interoptopus::patterns [−][src]
Expand description
Optional types that translate to binding with better semantics in languages supporting them.
Patterns are purely optional. If you want to use a certain pattern in your bindings you generally define one or more functions that use some of the types contained in this module.
Backends which support a pattern will then generate additional language-specific helpers and bindings for it. In any case, regardless whether a pattern is supported by a backend or not, fallback bindings will be available.
Pattern Support
Patterns are exclusively designed on top of existing, C-compatible functions and types. That means a backend will handle a pattern in one of three ways:
-
The pattern is supported and the backend will generate the raw, underlying type and / or a language-specific abstraction that safely and conveniently handles it. Examples include converting an
AsciiPointer
to a C#string
, or aclass
to a Pythonclass
. -
The pattern is not supported and will be omitted if the pattern was merely an aggregate of existing items. Examples include the
class
pattern in C which will not be emitted. However, this will not pose a problem as all constituent types and methods (functions) are still available as raw bindings. -
The pattern is not supported and will be replaced with a fallback type. Examples include the
AsciiPointer
which will become a regular*const u8
in C.
In other words, regardless of which pattern was used, the involved methods and types will always be accessible from any language.
Modules
ascii_pointer | Raw |
callbacks | Useful when |
class | Bundles function with common receiver into a |
option | Like a regular |
slice | Like a regular |
success_enum | For return enums with defined |
Enums
LibraryPattern | A pattern on a library level, usually involving both methods and types. |
TypePattern | A pattern on a type level. |