Skip to main content

Crate eventix

Crate eventix 

Source
Expand description

§eventix

A high-level calendar and recurrence library for Rust with timezone-aware scheduling, exceptions, and ICS import/export capabilities.

§Features

  • Timezone-aware events: All date/time fields use chrono with chrono-tz for proper timezone handling
  • Recurrence rules: Support for all seven RFC 5545 frequencies (secondly, minutely, hourly, daily, weekly, monthly, yearly)
  • Exceptions: Skip specific dates or apply custom filters (e.g., skip weekends)
  • ICS support: Import and export events using the iCalendar format (RFC 5545 compliant with TZID support)
  • Builder API: Ergonomic, fluent interface for creating events and calendars
  • Calendar view iterators: Lazy day/week traversal for UI-friendly calendar rendering
  • Gap validation: Find gaps between events, detect conflicts, and analyze schedule density
  • Schedule analysis: Unique features for occupancy metrics, availability finding, and conflict resolution

§Quick Start

use eventix::{Calendar, Event, Recurrence};

let mut cal = Calendar::new("My Calendar");

let event = Event::builder()
    .title("Weekly Team Meeting")
    .description("Discuss project progress")
    .start("2025-11-01 10:00:00", "America/New_York")
    .duration_hours(1)
    .recurrence(Recurrence::weekly().count(10))
    .build()
    .expect("Failed to build event");

cal.add_event(event);

§Timezone-Aware ICS Export

Events are exported with proper timezone information for compatibility with calendar applications:

use eventix::{Calendar, Event};

let mut cal = Calendar::new("Work Schedule");

// Non-UTC timezones include TZID parameter
let event = Event::builder()
    .title("Team Meeting")
    .start("2025-10-27 10:00:00", "America/New_York")
    .duration_hours(1)
    .build()
    .unwrap();

cal.add_event(event);
cal.export_to_ics("schedule.ics").unwrap();

// Generates: DTSTART;TZID=America/New_York:20251027T100000
// Compatible with Google Calendar, Outlook, and Apple Calendar

§Schedule Analysis (Unique Feature)

Find gaps, detect conflicts, and analyze schedule density:

use eventix::{Calendar, Event, gap_validation, timezone, Duration};

let mut cal = Calendar::new("Work Schedule");

// Add some events...
let event1 = Event::builder()
    .title("Morning Meeting")
    .start("2025-11-03 09:00:00", "America/New_York")
    .duration_hours(1)
    .build()?;

let event2 = Event::builder()
    .title("Afternoon Call")
    .start("2025-11-03 14:00:00", "America/New_York")
    .duration_hours(1)
    .build()?;

cal.add_event(event1);
cal.add_event(event2);

// Find gaps in schedule
let tz = timezone::parse_timezone("America/New_York")?;
let start = timezone::parse_datetime_with_tz("2025-11-03 08:00:00", tz)?;
let end = timezone::parse_datetime_with_tz("2025-11-03 18:00:00", tz)?;

let gaps = gap_validation::find_gaps(&cal, start, end, Duration::minutes(30))?;
println!("Found {} gaps of at least 30 minutes", gaps.len());

// Calculate schedule density
let density = gap_validation::calculate_density(&cal, start, end)?;
println!("Schedule occupancy: {:.1}%", density.occupancy_percentage);

§Modules

  • calendar - Calendar container for managing collections of events
  • event - Event types and builder API
  • gap_validation - Schedule analysis, gap detection, and conflict resolution (unique feature)
  • ics - ICS (iCalendar) import/export with TZID support
  • recurrence - Recurrence patterns (secondly, minutely, hourly, daily, weekly, monthly, yearly)
  • timezone - Timezone utilities with DST awareness
  • views - Lazy day/week calendar view iterators

§Examples

See the examples/ directory for more comprehensive examples:

  • basic.rs - Simple calendar creation and event management
  • calendar_views.rs - Lazy day and week view iteration for UI rendering
  • recurrence.rs - All seven RFC 5545 recurrence frequencies with lazy iteration and DST handling
  • ics_export.rs - ICS import/export functionality
  • timezone_ics_export.rs - Timezone-aware ICS export demonstration
  • gap_validation.rs - Schedule analysis and gap detection features

Re-exports§

pub use calendar::Calendar;
pub use event::Event;
pub use event::EventBuilder;
pub use event::EventStatus;
pub use recurrence::OccurrenceIterator;
pub use recurrence::Recurrence;
pub use views::DayIterator;
pub use views::DayView;
pub use views::OwnedEventOccurrence;
pub use views::WeekIterator;
pub use views::WeekView;

Modules§

calendar
Calendar type for managing collections of events
event
Event types and builder API
gap_validation
Gap and overlap validation for calendar events
ics
ICS (iCalendar) import and export functionality
recurrence
Recurrence rules and patterns for repeating events
timezone
Timezone handling utilities with DST awareness
views
Calendar day/week view iterators for UI-friendly rendering.

Structs§

DateTime
ISO 8601 combined date and time with time zone.
NaiveDate
ISO 8601 calendar date without timezone. Allows for every proleptic Gregorian date from Jan 1, 262145 BCE to Dec 31, 262143 CE. Also supports the conversion from ISO 8601 ordinal and week date.
NaiveDateTime
ISO 8601 combined date and time without timezone.
Utc
The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).

Enums§

EventixError
Error types that can occur in eventix operations
Tz
TimeZones built at compile time from the tz database

Type Aliases§

Duration
Alias of TimeDelta.
Result
Result type alias for eventix operations