Skip to main content

Crate reinhardt_core

Crate reinhardt_core 

Source
Expand description

§Reinhardt Core

Core components for the Reinhardt framework, providing fundamental types, exception handling, signals, macros, security, and validation utilities.

§Available Validators

The validators crate provides comprehensive validation utilities:

  • IPAddressValidator: IPv4/IPv6 address validation
  • PhoneNumberValidator: International phone number validation (E.164)
  • CreditCardValidator: Credit card validation with Luhn algorithm
  • IBANValidator: International bank account number validation
  • ColorValidator: Hex, RGB, HSL color validation
  • FileTypeValidator: MIME type and extension validation
  • CustomRegexValidator: User-defined regex pattern validation

§Available Backend Implementations

The backends crate provides multiple backend implementations:

  • Cache Backends: Redis (✅), DynamoDB (✅), Memcached (✅)
  • Email Backends: SMTP (✅), SendGrid (✅), AWS SES (✅), Mailgun (✅)
  • Queue Backends: Redis (✅), RabbitMQ (✅), AWS SQS (✅)
  • Session Backends: JWT (✅), Database (✅), Redis (✅), Cookie (✅), File (✅)
  • Storage Backends: S3 (✅), Azure Blob (✅), GCS (✅), FileSystem (✅), Memory (✅)

For detailed implementation and usage information, see the individual crate documentation in reinhardt-db, reinhardt-auth, reinhardt-mail, and reinhardt-tasks.

§Quick Start

use reinhardt_core::exception::{Error, ErrorKind};

// Create a typed application error
let err = Error::NotFound("Resource not found".to_string());
assert_eq!(err.kind(), ErrorKind::NotFound);

§Architecture

Key modules in this crate:

  • exception: Typed error hierarchy for HTTP and application-level errors
  • types: Fundamental types (URL, money, phone number, color, coordinates)
  • signals: Django-style signal/slot system for decoupled event handling
  • security: Password hashing, CSRF, XSS prevention, and security utilities
  • validators: Comprehensive input validation (IP, IBAN, phone, credit card)
  • serializers: Data serialization and deserialization framework
  • [pagination]: Cursor, page number, and limit-offset pagination strategies
  • [parsers]: Request body parsing (JSON, form, multipart)
  • [negotiation]: HTTP content negotiation utilities

§Feature Flags

FeatureDefaultDescription
typesenabledCore type definitions
exceptionenabledError hierarchy and HTTP status mapping
signalsenabledAsync signal/slot system
macrosenabledProcedural macros re-export
securityenabledPassword hashing and security utilities
validatorsenabledComprehensive input validation
serializersenabledData serialization framework
parsersdisabledRequest body parsers
paginationdisabledPagination strategies
negotiationdisabledHTTP content negotiation
messagesdisabledFlash message storage
pagedisabledServer-side page rendering types
reactivedisabledReactive state management
serdedisabledSerde serialization support
jsondisabledJSON serialization support
xmldisabledXML serialization support
yamldisabledYAML serialization support
paralleldisabledParallel processing with Rayon
i18ndisabledInternationalization with Fluent

Re-exports§

pub use apply_update::ApplyUpdate;
pub use crate::rate_limit::RateLimitStrategy;
pub use reinhardt_macros as macros;
pub use tokio;

Modules§

apply_update
Trait for applying partial updates to target structs.
endpoint
HTTP endpoint routing and handler registration. Endpoint metadata trait for HTTP Method Macros
exception
Error types and exception handling.
rate_limit
Rate limiting strategies. Rate limiting types and strategies.
security
Security utilities (password hashing, CSRF, etc.).
serde
Re-export of serde serialization types and serde_json.
serializers
Data serialization framework.
signals
Signal/event dispatch system.
types
Core type definitions. Core type definitions and common types for the Reinhardt framework.
validators
Field and data validators. Advanced validators for Reinhardt

Macros§

connect_receiver
Helper macro for connecting receivers with a simpler syntax

Attribute Macros§

async_trait