8 releases

Uses new Rust 2024

new 0.1.16 Apr 7, 2025
0.1.15 Apr 1, 2025
0.1.13 Mar 30, 2025
0.0.14 Apr 1, 2025

#2257 in Rust patterns

Download history 510/week @ 2025-03-28 187/week @ 2025-04-04

697 downloads per month
Used in 15 crates (12 directly)

MIT license

25KB
627 lines

Swamp Types

Core data structures for representing the type system of the Swamp programming language.

This crate defines the Type enum and associated structs used throughout the Swamp compiler and tooling to represent and manipulate types.

Overview

  • Type Enum: The central enum representing all possible types in Swamp, including:
    • Primitives (Int, Float, String, Bool, Unit, Never)
    • Containers (Tuple, Slice, SlicePair)
    • User-Defined Types (NamedStruct, AnonymousStruct, Enum)
    • Functions (Function with Signature)
    • Modifiers (Optional, MutableReference)
    • Generics (Generic, Blueprint, Variable)
    • External/FFI types (External)
  • Supporting Structs: Detailed definitions for complex types like NamedStructType, EnumType, Signature, ParameterizedTypeBlueprint, etc.
  • Type Compatibility: Includes logic (compatible_with, assignable_type) for checking type relationships.
  • Source Information: Integrates with swamp-node to link types back to source code locations.

Installation

Add this to your Cargo.toml:

[dependencies]
swamp-types = "0.1.16"

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright

Copyright (c) Peter Bjorklund. All rights reserved. https://github.com/swamp/swamp

Dependencies

~22KB