Skip to main content

Crate liiga_teletext

Crate liiga_teletext 

Source
Expand description

Finnish Hockey League (Liiga) Teletext Viewer Library

This library provides functionality for fetching and displaying Finnish Hockey League game data in a teletext-style format.

§Examples

use liiga_teletext::data_fetcher::api::fetch_liiga_data;
use liiga_teletext::teletext_ui::{TeletextPage, GameResultData};
use liiga_teletext::error::AppError;

#[tokio::main]
async fn main() -> Result<(), AppError> {
    // Fetch game data
    let (games, date) = fetch_liiga_data(Some("2024-01-15".to_string())).await?;

    // Create teletext page
    let mut page = TeletextPage::new(
        221,
        "JÄÄKIEKKO".to_string(),
        "RUNKOSARJA".to_string(),
        false,
        true,
        false,
        false,
        false, // wide_mode
    );

    // Add games to the page
    for game in &games {
        page.add_game_result(GameResultData::new(game));
    }

    // Render the page to stdout
    let mut stdout = std::io::stdout();
    page.render_buffered(&mut stdout)?;

    Ok(())
}

Re-exports§

pub use config::Config;
pub use data_fetcher::api::fetch_liiga_data;
pub use data_fetcher::models::DetailedGameResponse;
pub use data_fetcher::models::GameData;
pub use data_fetcher::models::ScheduleResponse;
pub use error::AppError;
pub use teletext_ui::GameResultData;
pub use teletext_ui::TeletextPage;
pub use teletext_ui::TeletextPageConfig;
pub use ui::components::abbreviations::get_team_abbreviation;
pub use ui::teletext::CompactDisplayConfig;
pub use data_fetcher::cache::CacheInfo;
pub use data_fetcher::cache::CacheStats;
pub use data_fetcher::cache::clear_all_caches;
pub use data_fetcher::cache::get_all_cache_stats;
pub use data_fetcher::cache::get_detailed_cache_debug_info;
pub use data_fetcher::cache::reset_all_caches_with_confirmation;

Modules§

config
constants
Application-wide constants and configuration values
data_fetcher
error
teletext_ui
testing_utils
ui

Constants§

NAME
Library name
VERSION
Current version of the library