repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/components/subscription.rs
crates/synd_term/src/ui/components/subscription.rs
use std::borrow::Cow; use itertools::Itertools; use ratatui::{ prelude::{Alignment, Buffer, Constraint, Layout, Rect}, style::{Modifier, Style, Stylize}, text::{Line, Span}, widgets::{ Block, BorderType, Borders, Cell, Padding, Paragraph, Row, Table as RatatuiTable, Tabs, Widget, },...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/components/mod.rs
crates/synd_term/src/ui/components/mod.rs
use crate::{ application::Features, auth::AuthenticationProvider, ui::components::{ authentication::Authentication, entries::Entries, filter::Filter, gh_notifications::GhNotifications, status::StatusLine, subscription::Subscription, tabs::Tabs, }, }; pub(crate) mod authenticatio...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/components/authentication.rs
crates/synd_term/src/ui/components/authentication.rs
use ratatui::{ prelude::{Alignment, Buffer, Constraint, Layout, Rect}, style::{Modifier, Style}, text::{Line, Span, Text}, widgets::{ Block, Borders, HighlightSpacing, List, ListItem, ListState, Paragraph, StatefulWidget, Widget, }, }; use synd_auth::device_flow::DeviceAuthorizationR...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/components/filter/feed.rs
crates/synd_term/src/ui/components/filter/feed.rs
use synd_feed::types::Requirement; use crate::{ types, ui::components::filter::{ CategoryFilterer, ComposedFilterer, FilterResult, Filterable, MatcherFilterer, category::CategoriesState, composed::Composable, }, }; #[derive(Debug)] pub(crate) struct FeedHandler { pub(super) requirement...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/components/filter/category.rs
crates/synd_term/src/ui/components/filter/category.rs
use std::collections::{HashMap, HashSet}; use synd_feed::types::Category; use crate::{ application::Populate, config::{Categories, Icon}, types::{self, github::Notification}, ui::{ self, components::filter::{Composable, FilterResult, Filterable}, }, }; #[allow(dead_code)] static L...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/components/filter/mod.rs
crates/synd_term/src/ui/components/filter/mod.rs
use std::{cell::RefCell, collections::HashMap, rc::Rc}; use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; use itertools::Itertools; use ratatui::{ buffer::Buffer, layout::{Constraint, Layout, Rect}, style::Stylize, text::{Line, Span}, widgets::{Block, Padding, Widget}, }; use synd_feed::type...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/components/filter/github.rs
crates/synd_term/src/ui/components/filter/github.rs
use crate::ui::components::filter::category::CategoriesState; #[derive(Debug)] pub(super) struct GhNotificationHandler { pub(super) categories_state: CategoriesState, } impl GhNotificationHandler { pub(crate) fn new() -> Self { Self { categories_state: CategoriesState::new(), } ...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/components/filter/composed.rs
crates/synd_term/src/ui/components/filter/composed.rs
use crate::ui::components::filter::{FilterResult, Filterable}; #[derive(Default, Debug, Clone)] pub(crate) struct ComposedFilterer<L, R> { left: L, right: R, } impl<L, R> ComposedFilterer<L, R> { pub(crate) fn new(left: L, right: R) -> Self { Self { left, right } } pub(crate) fn update_le...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/components/filter/matcher.rs
crates/synd_term/src/ui/components/filter/matcher.rs
use crate::{ matcher::Matcher, types::{self, github::Notification}, ui::components::filter::{FilterResult, Filterable}, }; #[derive(Default, Clone, Debug)] pub(crate) struct MatcherFilterer { matcher: Matcher, } impl MatcherFilterer { pub(crate) fn new(matcher: Matcher) -> Self { Self { ma...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/components/gh_notifications/mod.rs
crates/synd_term/src/ui/components/gh_notifications/mod.rs
use std::{borrow::Cow, collections::HashMap, fmt::Debug, ops::ControlFlow}; use chrono_humanize::{Accuracy, HumanTime, Tense}; use itertools::Itertools; use ratatui::{ buffer::Buffer, layout::{Alignment, Constraint, Layout, Rect}, style::{Modifier, Style, Styled, Stylize}, text::{Line, Span}, widge...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/components/gh_notifications/filter_popup.rs
crates/synd_term/src/ui/components/gh_notifications/filter_popup.rs
use ratatui::{ buffer::Buffer, layout::{Alignment, Constraint, Layout, Rect}, style::{Modifier, Style, Stylize}, text::{Line, Span}, widgets::{Block, Borders, Padding, Widget}, }; use crate::{ client::github::{FetchNotificationInclude, FetchNotificationParticipating}, types::github::{Notifi...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/components/collections/filterable.rs
crates/synd_term/src/ui/components/collections/filterable.rs
use std::ops::ControlFlow; use crate::{ application::{Direction, IndexOutOfRange, Populate}, ui::components::filter::{FilterResult, Filterable}, }; pub(crate) struct FilterableVec<T, F> { items: Vec<T>, effective_items: Vec<usize>, selected_item_index: usize, filterer: F, } impl<T, F> Filtera...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/components/collections/mod.rs
crates/synd_term/src/ui/components/collections/mod.rs
mod filterable; pub(super) use filterable::FilterableVec;
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/widgets/throbber.rs
crates/synd_term/src/ui/widgets/throbber.rs
// Currently throbber-widgets-tui dependes ratatui 0.24 // https://github.com/arkbig/throbber-widgets-tui/blob/cd6d1e1e1f38e221d8462df66172dcc370582bbd/Cargo.toml#L20 use ratatui::{ prelude::{Buffer, Rect}, style::Style, text::Span, widgets::StatefulWidget, }; #[derive(Debug, Clone, Default)] pub stru...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/widgets/table.rs
crates/synd_term/src/ui/widgets/table.rs
use ratatui::{ buffer::Buffer, layout::{Constraint, Rect}, style::Modifier, widgets::{Row, StatefulWidget, TableState}, }; use crate::ui::{self, theme::EntriesTheme}; pub(crate) struct TableBuilder<H, R, C, T, S, M> { header: H, rows: R, widths: C, theme: T, selected_idx: S, hi...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/widgets/prompt.rs
crates/synd_term/src/ui/widgets/prompt.rs
use crossterm::event::{KeyCode, KeyEvent}; use ratatui::{ buffer::Buffer, layout::Rect, style::Stylize, text::{Line, Span}, widgets::Widget, }; use unicode_segmentation::GraphemeCursor; use crate::{application::event::KeyEventResult, command::Command}; #[derive(Debug, Clone, Copy)] enum Move { ...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/widgets/mod.rs
crates/synd_term/src/ui/widgets/mod.rs
pub(crate) mod prompt; pub(crate) mod scrollbar; pub(crate) mod table; pub(crate) mod throbber;
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/ui/widgets/scrollbar.rs
crates/synd_term/src/ui/widgets/scrollbar.rs
use ratatui::{ buffer::Buffer, layout::Rect, widgets::{ScrollbarOrientation, ScrollbarState, StatefulWidget}, }; use crate::ui::Context; pub(in crate::ui) struct Scrollbar { pub(in crate::ui) content_length: usize, pub(in crate::ui) position: usize, } impl Scrollbar { pub(in crate::ui) fn ren...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/interact/process.rs
crates/synd_term/src/interact/process.rs
use std::{ io::{self, ErrorKind}, path::PathBuf, process::{Command, Stdio}, }; use itertools::Itertools; use url::Url; use crate::interact::{Interact, OpenBrowserError, OpenEditor, OpenTextBrowser, OpenWebBrowser}; pub struct ProcessInteractor { text_browser: TextBrowserInteractor, } impl ProcessInt...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/interact/mod.rs
crates/synd_term/src/interact/mod.rs
use std::{io, path::PathBuf}; #[cfg(feature = "integration")] pub mod mock; mod process; pub use process::{ProcessInteractor, TextBrowserInteractor}; use thiserror::Error; use url::Url; pub trait Interact: OpenWebBrowser + OpenTextBrowser + OpenEditor {} #[derive(Debug, Error)] pub enum OpenBrowserError { #[err...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/src/interact/mock.rs
crates/synd_term/src/interact/mock.rs
use std::cell::RefCell; use url::Url; use crate::interact::{ Interact, OpenBrowserError, OpenEditor, OpenEditorError, OpenTextBrowser, OpenWebBrowser, }; pub struct MockInteractor { editor_buffer: RefCell<Vec<String>>, browser_urls: RefCell<Vec<String>>, } impl MockInteractor { pub fn new() -> Self ...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/tests/integration.rs
crates/synd_term/tests/integration.rs
#[cfg(feature = "integration")] mod test { use std::path::{Path, PathBuf}; use std::sync::Once; use synd_term::{ application::{Config, Features}, auth::Credential, key, shift, }; use synd_test::temp_dir; mod helper; use crate::test::helper::{ TestCase, focus...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/tests/test/helper.rs
crates/synd_term/tests/test/helper.rs
use std::{path::PathBuf, sync::Once, time::Duration}; use chrono::{DateTime, Utc}; use futures_util::future; use octocrab::Octocrab; use ratatui::backend::TestBackend; use synd_api::{ cli::{CacheOptions, ServeOptions, TlsOptions}, client::github::GithubClient, dependency::Dependency, repository::{Subsc...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/benches/render.rs
crates/synd_term/benches/render.rs
use criterion::Criterion; use pprof::criterion::{Output, PProfProfiler}; mod bench { use criterion::Criterion; use synd_term::{integration, key}; mod helper; pub(super) fn render(c: &mut Criterion) { c.bench_function("render", move |b| { b.to_async(runtime()).iter_batched( ...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
ymgyt/syndicationd
https://github.com/ymgyt/syndicationd/blob/956bec58fcb6dbd9e8740d925649772b1670ead9/crates/synd_term/benches/bench/helper.rs
crates/synd_term/benches/bench/helper.rs
use std::time::Duration; use ratatui::backend::TestBackend; use synd_term::{ application::{Application, Cache, Config}, client::synd_api::Client, config::Categories, interact::mock::MockInteractor, terminal::Terminal, ui::theme::Theme, }; use url::Url; pub fn init_app() -> Application { le...
rust
Apache-2.0
956bec58fcb6dbd9e8740d925649772b1670ead9
2026-01-04T20:11:26.769763Z
false
rust-ux/uX
https://github.com/rust-ux/uX/blob/9df9b3aa307a31fce57ee4a3529c2ae20427ef39/src/lib.rs
src/lib.rs
//! # uX - non-standard-width integers types //! //! When non-standard-width integers is required in an applications, the norm is to use a larger container and make sure the value is within range after manipulation. uX aims to take care of this once and for all by: //! //! - Providing `u1`-`u127` and `i1`-`i127` types ...
rust
Apache-2.0
9df9b3aa307a31fce57ee4a3529c2ae20427ef39
2026-01-04T20:20:28.114552Z
true
rust-ux/uX
https://github.com/rust-ux/uX/blob/9df9b3aa307a31fce57ee4a3529c2ae20427ef39/src/conversion.rs
src/conversion.rs
use crate::*; /// The error type returned when a checked integral type conversion fails. #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct TryFromIntError(pub(crate) ()); impl From<lib::core::num::TryFromIntError> for TryFromIntError { fn from(_: lib::core::num::TryFromIntError) -> TryFromIntError { ...
rust
Apache-2.0
9df9b3aa307a31fce57ee4a3529c2ae20427ef39
2026-01-04T20:20:28.114552Z
true
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/examples/rust/src/main.rs
examples/rust/src/main.rs
use auto_traffic_control::v1::atc_service_client::AtcServiceClient; use auto_traffic_control::v1::GetVersionRequest; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let mut atc_service = AtcServiceClient::connect("http://localhost:4747").await?; let response = atc_service.get_versio...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/utilities/test-server/src/main.rs
utilities/test-server/src/main.rs
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4}; use semver::Version as SemVer; use tonic::transport::{Error, Server}; use tonic::{Request, Response, Status}; use auto_traffic_control::v1::atc_service_server::AtcServiceServer; use auto_traffic_control::v1::{GetVersionRequest, GetVersionResponse, Version}; struct ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/utilities/debug-client/src/main.rs
utilities/debug-client/src/main.rs
use tokio_stream::StreamExt; use auto_traffic_control::v1::event_service_client::EventServiceClient; use auto_traffic_control::v1::stream_response::Event; use auto_traffic_control::v1::StreamRequest; fn should_print(event: &Event) -> bool { match event { Event::AirplaneCollided(_) => true, Event::...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/rendering.rs
game/src/rendering.rs
use bevy::prelude::*; pub const FONT_COLOR: Color = Color::BLACK; pub enum RenderLayer { Landscape, Decoration, RoutingGrid, Airport, Airplane, Ui, } impl RenderLayer { pub fn z(&self) -> f32 { match self { RenderLayer::Landscape => 0.0, RenderLayer::Decora...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/main.rs
game/src/main.rs
use std::sync::Arc; use bevy::prelude::*; use tokio::sync::broadcast::channel; use crate::api::Api; use crate::command::{Command, CommandReceiver, CommandSender}; use crate::event::{Event, EventReceiver, EventSender}; use crate::scene::{GameOverPlugin, GamePlugin, MainMenuPlugin}; use crate::store::{Store, StoreWatch...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/command/sender.rs
game/src/command/sender.rs
use bevy::prelude::*; use tokio::sync::broadcast::Sender; use crate::command::{Command, CommandReceiver}; #[derive(Clone, Debug, Resource)] pub struct CommandSender(Sender<Command>); impl CommandSender { pub fn new(sender: Sender<Command>) -> Self { Self(sender) } pub fn get(&self) -> &Sender<Co...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/command/mod.rs
game/src/command/mod.rs
use crate::components::{AirplaneId, FlightPlan}; pub use self::bus::CommandBus; pub use self::receiver::CommandReceiver; pub use self::sender::CommandSender; mod bus; mod receiver; mod sender; #[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] pub enum Command { StartGame, UpdateFlightPlan(Airplan...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/command/bus.rs
game/src/command/bus.rs
use bevy::prelude::*; use crate::command::{CommandReceiver, CommandSender}; #[derive(Debug)] pub struct CommandBus { receiver: CommandReceiver, } impl CommandBus { pub fn receiver(&mut self) -> &mut CommandReceiver { &mut self.receiver } } impl FromWorld for CommandBus { fn from_world(world:...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/command/receiver.rs
game/src/command/receiver.rs
use bevy::prelude::*; use tokio::sync::broadcast::Receiver; use crate::command::Command; #[derive(Debug, Resource)] pub struct CommandReceiver(Receiver<Command>); impl CommandReceiver { pub fn new(receiver: Receiver<Command>) -> Self { Self(receiver) } pub fn get_mut(&mut self) -> &mut Receiver<...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/store/watcher.rs
game/src/store/watcher.rs
use std::sync::Arc; use auto_traffic_control::v1::get_game_state_response::GameState; use auto_traffic_control::v1::Airplane; use crate::api::AsApi; use crate::components::{AirplaneId, FlightPlan, Location, Tag}; use crate::event::EventReceiver; use crate::map::Map; use crate::{Event, Store}; #[derive(Debug)] pub st...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/store/mod.rs
game/src/store/mod.rs
use std::sync::Arc; use dashmap::DashMap; use parking_lot::Mutex; use auto_traffic_control::v1::get_game_state_response::GameState; use auto_traffic_control::v1::Airplane; use crate::map::Map; pub use self::watcher::StoreWatcher; mod watcher; pub type SharedGameState = Arc<Mutex<GameState>>; pub type SharedMap = ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/components/airplane_id.rs
game/src/components/airplane_id.rs
use bevy::prelude::*; use crate::api::AsApi; #[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default, Component)] pub struct AirplaneId(String); impl AirplaneId { pub fn new(id: String) -> Self { Self(id) } #[allow(dead_code)] // TODO: Remove when the id is read pub fn get(&self...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/components/collider.rs
game/src/components/collider.rs
use bevy::prelude::*; #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default, Component)] pub struct Collider; #[cfg(test)] mod tests { use super::Collider; #[test] fn trait_send() { fn assert_send<T: Send>() {} assert_send::<Collider>(); } #[test] fn trai...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/components/travelled_route.rs
game/src/components/travelled_route.rs
use bevy::prelude::*; use crate::map::Node; #[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default, Component)] pub struct TravelledRoute(Vec<Node>); impl TravelledRoute { pub fn new(route: Vec<Node>) -> Self { Self(route) } pub fn get(&self) -> &Vec<Node> { &self.0 } ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/components/landing.rs
game/src/components/landing.rs
use bevy::prelude::*; #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default, Component)] pub struct Landing; #[cfg(test)] mod tests { use super::Landing; #[test] fn trait_send() { fn assert_send<T: Send>() {} assert_send::<Landing>(); } #[test] fn trait_s...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/components/speed.rs
game/src/components/speed.rs
use bevy::prelude::*; #[derive(Copy, Clone, PartialEq, PartialOrd, Debug, Component)] pub struct Speed(f32); impl Speed { pub fn new(speed: f32) -> Self { Self(speed) } pub fn get(&self) -> f32 { self.0 } } #[cfg(test)] mod tests { use super::Speed; #[test] fn trait_send...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/components/mod.rs
game/src/components/mod.rs
pub use self::airplane::*; pub use self::airplane_id::*; pub use self::collider::*; pub use self::flight_plan::*; pub use self::landing::*; pub use self::location::*; pub use self::speed::*; pub use self::tag::*; pub use self::travelled_route::*; mod airplane; mod airplane_id; mod collider; mod flight_plan; mod landin...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/components/location.rs
game/src/components/location.rs
use std::fmt::{Display, Formatter}; use bevy::prelude::*; use geo::Point; use auto_traffic_control::v1::Point as ApiPoint; use crate::api::AsApi; use crate::map::Node; use crate::TILE_SIZE; #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default, Component)] pub struct Location { x: i32, ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/components/tag.rs
game/src/components/tag.rs
use bevy::prelude::*; use auto_traffic_control::v1::Tag as ApiTag; use crate::api::AsApi; #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Component)] pub enum Tag { Blue, Red, } impl AsApi for Tag { type ApiType = ApiTag; fn as_api(&self) -> Self::ApiType { match self { ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/components/flight_plan.rs
game/src/components/flight_plan.rs
use bevy::prelude::*; use auto_traffic_control::v1::update_flight_plan_error::ValidationError; use auto_traffic_control::v1::Node as ApiNode; use crate::api::AsApi; use crate::map::{Node, MAP_HEIGHT_RANGE, MAP_WIDTH_RANGE}; #[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default, Component)] pub struct ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/components/airplane.rs
game/src/components/airplane.rs
use bevy::prelude::*; pub const AIRPLANE_SIZE: f32 = 24.0; #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default, Component)] pub struct Airplane; #[cfg(test)] mod tests { use super::Airplane; #[test] fn trait_send() { fn assert_send<T: Send>() {} assert_send::<Airpl...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/scene/main_menu.rs
game/src/scene/main_menu.rs
use bevy::prelude::*; use crate::rendering::RenderLayer; use crate::{setup_landscape, AppState}; pub struct MainMenuPlugin; impl Plugin for MainMenuPlugin { fn build(&self, app: &mut App) { app.add_system_set( SystemSet::on_enter(AppState::MainMenu) .with_system(setup_landscap...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/scene/game_over.rs
game/src/scene/game_over.rs
use bevy::prelude::*; use crate::rendering::FONT_COLOR; use crate::AppState; pub struct GameOverPlugin; impl Plugin for GameOverPlugin { fn build(&self, app: &mut App) { app.add_system_set(SystemSet::on_enter(AppState::GameOver).with_system(spawn)) .add_system_set(SystemSet::on_update(AppStat...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/scene/game.rs
game/src/scene/game.rs
use bevy::prelude::*; use crate::event::{Event, EventBus}; use crate::map::Map; use crate::rendering::FONT_COLOR; use crate::resources::Score; use crate::systems::{ despawn_airplane, detect_collision, follow_flight_plan, generate_flight_plan, land_airplane, rotate_airplane, setup_airport, setup_grid, setup_lan...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/scene/mod.rs
game/src/scene/mod.rs
pub use self::game::GamePlugin; pub use self::game_over::GameOverPlugin; pub use self::main_menu::MainMenuPlugin; mod game; mod game_over; mod main_menu;
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/api/event.rs
game/src/api/event.rs
use std::pin::Pin; use tokio_stream::wrappers::BroadcastStream; use tokio_stream::StreamExt; use tonic::codegen::futures_core::Stream; use tonic::{Request, Response, Status}; use auto_traffic_control::v1::{StreamRequest, StreamResponse}; use crate::api::AsApi; use crate::event::EventSender; #[derive(Clone, Debug)] ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/api/atc.rs
game/src/api/atc.rs
use semver::Version as SemVer; use tonic::{Request, Response, Status}; use auto_traffic_control::v1::{GetVersionRequest, GetVersionResponse, Version}; pub struct AtcService; #[tonic::async_trait] impl auto_traffic_control::v1::atc_service_server::AtcService for AtcService { async fn get_version( &self, ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/api/map.rs
game/src/api/map.rs
use std::sync::Arc; use tonic::{Request, Response, Status}; use auto_traffic_control::v1::{ GetMapRequest, GetMapResponse, NodeToPointRequest, NodeToPointResponse, Point, }; use crate::api::AsApi; use crate::map::Node; use crate::store::Store; #[derive(Clone, Debug, Default)] pub struct MapService { store: ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/api/game.rs
game/src/api/game.rs
use std::sync::Arc; use tonic::{Request, Response, Status}; use auto_traffic_control::v1::{ GetGameStateRequest, GetGameStateResponse, StartGameRequest, StartGameResponse, }; use crate::command::{Command, CommandSender}; use crate::store::{SharedGameState, Store}; #[derive(Clone, Debug)] pub struct GameService ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/api/mod.rs
game/src/api/mod.rs
use std::net::{IpAddr, SocketAddr}; use std::str::FromStr; use std::sync::Arc; use tonic::transport::{Error, Server as GrpcServer}; use ::auto_traffic_control::v1::airplane_service_server::AirplaneServiceServer; use ::auto_traffic_control::v1::atc_service_server::AtcServiceServer; use ::auto_traffic_control::v1::even...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/api/airplane.rs
game/src/api/airplane.rs
use std::sync::Arc; use tonic::{Request, Response, Status}; use auto_traffic_control::v1::update_flight_plan_response::Payload; use auto_traffic_control::v1::{ GetAirplaneRequest, GetAirplaneResponse, UpdateFlightPlanError, UpdateFlightPlanRequest, UpdateFlightPlanResponse, UpdateFlightPlanSuccess, }; use cr...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/event/sender.rs
game/src/event/sender.rs
use bevy::prelude::*; use tokio::sync::broadcast::Sender; use crate::event::{Event, EventReceiver}; #[derive(Clone, Debug, Resource)] pub struct EventSender(Sender<Event>); impl EventSender { pub fn new(sender: Sender<Event>) -> Self { Self(sender) } pub fn get(&self) -> &Sender<Event> { ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/event/mod.rs
game/src/event/mod.rs
use auto_traffic_control::v1::stream_response::Event as ApiEvent; use auto_traffic_control::v1::{ Airplane, AirplaneCollided, AirplaneDetected, AirplaneLanded, AirplaneMoved, FlightPlanUpdated, GameStarted, GameStopped, LandingAborted, }; use crate::api::AsApi; use crate::components::{AirplaneId, FlightPlan, L...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/event/bus.rs
game/src/event/bus.rs
use bevy::prelude::*; use crate::event::EventSender; #[derive(Clone, Debug)] pub struct EventBus { sender: EventSender, } impl EventBus { pub fn sender(&self) -> &EventSender { &self.sender } } impl FromWorld for EventBus { fn from_world(world: &mut World) -> Self { let sender = worl...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/event/receiver.rs
game/src/event/receiver.rs
use bevy::prelude::*; use tokio::sync::broadcast::Receiver; use crate::event::Event; #[derive(Debug, Resource)] pub struct EventReceiver(Receiver<Event>); impl EventReceiver { pub fn new(receiver: Receiver<Event>) -> Self { Self(receiver) } pub fn get_mut(&mut self) -> &mut Receiver<Event> { ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/follow_flight_plan.rs
game/src/systems/follow_flight_plan.rs
use bevy::prelude::*; use geo::algorithm::euclidean_distance::EuclideanDistance; use geo::point; use crate::components::{AirplaneId, FlightPlan, Location, Speed, TravelledRoute}; use crate::event::{Event, EventBus}; use crate::map::Direction; pub fn follow_flight_plan( time: Res<Time>, mut query: Query<( ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/land_airplane.rs
game/src/systems/land_airplane.rs
use bevy::prelude::*; use crate::components::{FlightPlan, Landing}; use crate::map::Map; pub fn land_airplane( mut commands: Commands, map: Res<Map>, query: Query<(Entity, &FlightPlan), Without<Landing>>, ) { for (entity, flight_plan) in query.iter() { if flight_plan.get().len() != 1 { ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/setup_landscape.rs
game/src/systems/setup_landscape.rs
use bevy::prelude::*; use rand::{thread_rng, Rng}; use crate::rendering::RenderLayer; use crate::{SCREEN_HEIGHT, SCREEN_WIDTH, TILE_SIZE}; pub fn setup_landscape( mut commands: Commands, asset_server: Res<AssetServer>, mut texture_atlases: ResMut<Assets<TextureAtlas>>, ) { let mut rng = thread_rng(); ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/generate_flight_plan.rs
game/src/systems/generate_flight_plan.rs
use bevy::prelude::*; use rand::prelude::*; use crate::components::{AirplaneId, FlightPlan, Landing, TravelledRoute}; use crate::event::{Event, EventBus}; use crate::map::{Map, Node, MAP_HEIGHT_RANGE, MAP_WIDTH_RANGE}; const FLIGHT_PLAN_LENGTH: usize = 4; pub fn generate_flight_plan( map: Res<Map>, mut query...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/detect_collisions.rs
game/src/systems/detect_collisions.rs
use bevy::prelude::*; use bevy::sprite::collide_aabb::collide; use crate::components::{AirplaneId, Collider, AIRPLANE_SIZE}; use crate::event::{Event, EventBus}; use crate::AppState; pub struct Size { airplane: Vec2, } impl Default for Size { fn default() -> Self { Self { airplane: Vec2::...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/rotate_airplane.rs
game/src/systems/rotate_airplane.rs
use bevy::prelude::*; use crate::components::{FlightPlan, TravelledRoute}; use crate::map::Direction; pub fn rotate_airplane(mut query: Query<(&mut FlightPlan, &mut Transform, &mut TravelledRoute)>) { for (flight_plan, mut transform, travelled_route) in query.iter_mut() { let last_point = travelled_route ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/despawn_airplane.rs
game/src/systems/despawn_airplane.rs
use bevy::prelude::*; use crate::components::{AirplaneId, FlightPlan, Landing, Tag}; use crate::event::{Event, EventBus}; use crate::map::{Airport, Map, Node}; use crate::rendering::RenderLayer; use crate::resources::Score; pub fn despawn_airplane( mut commands: Commands, map: Res<Map>, mut score: ResMut<...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/setup_cameras.rs
game/src/systems/setup_cameras.rs
use bevy::prelude::*; pub fn setup_cameras(mut commands: Commands) { commands.spawn(Camera2dBundle::default()); }
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/mod.rs
game/src/systems/mod.rs
pub use self::change_app_state::*; pub use self::despawn_airplane::*; pub use self::detect_collisions::*; pub use self::follow_flight_plan::*; pub use self::generate_flight_plan::*; pub use self::land_airplane::*; pub use self::rotate_airplane::*; pub use self::setup_airport::*; pub use self::setup_cameras::*; pub use ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/change_app_state.rs
game/src/systems/change_app_state.rs
use bevy::prelude::*; use crate::command::CommandBus; use crate::{AppState, Command}; pub fn change_app_state( mut app_state: ResMut<State<AppState>>, mut command_bus: Local<CommandBus>, ) { let mut queued_transition = false; while let Ok(command) = command_bus.receiver().get_mut().try_recv() { ...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/update_flight_plan.rs
game/src/systems/update_flight_plan.rs
use bevy::prelude::*; use crate::command::{Command, CommandBus}; use crate::components::{AirplaneId, FlightPlan}; use crate::event::{Event, EventBus}; use crate::map::Map; pub fn update_flight_plan( map: Res<Map>, mut query: Query<(&AirplaneId, &mut FlightPlan)>, mut command_bus: Local<CommandBus>, ev...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/spawn_airplane.rs
game/src/systems/spawn_airplane.rs
use bevy::prelude::*; use rand::{thread_rng, Rng}; use crate::components::{ Airplane, AirplaneIdGenerator, Collider, FlightPlan, Location, Speed, Tag, TravelledRoute, }; use crate::event::{Event, EventBus}; use crate::map::{Direction, Node, MAP_HEIGHT_RANGE, MAP_WIDTH_RANGE}; use crate::rendering::RenderLayer; //...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/setup_grid.rs
game/src/systems/setup_grid.rs
use bevy::prelude::*; use crate::map::Map; use crate::rendering::RenderLayer; pub fn setup_grid(map: Res<Map>, mut commands: Commands) { for node in map .routing_grid() .iter() .filter(|node| !node.is_restricted()) { let point = node.as_point(); commands.spawn(SpriteBu...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/systems/setup_airport.rs
game/src/systems/setup_airport.rs
use bevy::prelude::*; use crate::components::Tag; use crate::map::{Direction, Map}; use crate::rendering::RenderLayer; use crate::TILE_SIZE; pub fn setup_airport( mut commands: Commands, map: Res<Map>, asset_server: Res<AssetServer>, mut texture_atlases: ResMut<Assets<TextureAtlas>>, ) { let textu...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/map/node.rs
game/src/map/node.rs
use std::cmp::{max, min}; use std::fmt::{Display, Formatter}; use bevy::prelude::*; use geo::{point, Point}; use auto_traffic_control::v1::Node as ApiNode; use crate::api::AsApi; use crate::map::{MAP_HEIGHT, MAP_HEIGHT_RANGE, MAP_WIDTH, MAP_WIDTH_RANGE}; use crate::TILE_SIZE; #[derive(Copy, Clone, Eq, PartialEq, Or...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/map/mod.rs
game/src/map/mod.rs
use std::ops::RangeInclusive; use bevy::prelude::Resource; use auto_traffic_control::v1::Map as ApiMap; use crate::api::AsApi; use crate::components::Tag; use crate::{SCREEN_HEIGHT, SCREEN_WIDTH, TILE_SIZE}; pub use self::airport::*; pub use self::direction::*; pub use self::node::Node; mod airport; mod direction;...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/map/airport.rs
game/src/map/airport.rs
use auto_traffic_control::v1::Airport as ApiAirport; use crate::api::AsApi; use crate::components::Tag; use crate::map::{Direction, Node}; #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] pub struct Airport { node: Node, runway: Direction, tag: Tag, } impl Airport { pub fn new(node...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/map/direction.rs
game/src/map/direction.rs
use std::fmt::Debug; use bevy::prelude::Vec3; use geo::Point; #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] pub enum Direction { North, NorthEast, East, SouthEast, South, SouthWest, West, NorthWest, } impl Direction { pub fn between(a: &Point<f32>, b: &Point<...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/resources/mod.rs
game/src/resources/mod.rs
pub use self::score::Score; mod score;
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/game/src/resources/score.rs
game/src/resources/score.rs
use bevy::prelude::*; #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default, Resource)] pub struct Score(u32); impl Score { pub fn new() -> Self { Self::default() } pub fn get(&self) -> u32 { self.0 } pub fn increment(&mut self) { self.0 += 1; } }...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/sdk/rust/build.rs
sdk/rust/build.rs
use std::path::PathBuf; use glob::glob; fn main() -> Result<(), Box<dyn std::error::Error>> { println!("cargo:rerun-if-changed=api"); let proto_path = PathBuf::from("api"); let protocol_buffers: Vec<PathBuf> = glob("api/**/*.proto") .unwrap() .map(|path| path.unwrap()) .collect()...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
jdno/auto-traffic-control
https://github.com/jdno/auto-traffic-control/blob/b5972dfbfedf8419727adc116bf77951c8cc5202/sdk/rust/src/lib.rs
sdk/rust/src/lib.rs
// tonic does not derive `Eq` for the gRPC message types, which causes a warning from Clippy. The // current suggestion is to explicitly allow the lint in the module that imports the protos. // Read more: https://github.com/hyperium/tonic/issues/1056 #![allow(clippy::derive_partial_eq_without_eq)] pub mod v1 { ton...
rust
Apache-2.0
b5972dfbfedf8419727adc116bf77951c8cc5202
2026-01-04T20:20:35.289412Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch09/linz/src/parser.rs
ch09/linz/src/parser.rs
//! # 線形型言語のパーサ //! //! λ計算に線形型システムを適用した独自の線形型言語のパーサ。 //! 独自言語の構文は以下を参照。 //! //! ## 構文 //! //! ```text //! <VAR> := 1文字以上のアルファベットから成り立つ変数 //! //! <E> := <LET> | <IF> | <SPLIT> | <FREE> | <APP> | <VAR> | <QVAL> //! //! <LET> := let <VAR> : <T> = <E>; <E> //! <IF> := if <E> { <E> } else { <E> } //! <SPLIT> := ...
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch09/linz/src/helper.rs
ch09/linz/src/helper.rs
pub trait SafeAdd: Sized { fn safe_add(&self, n: &Self) -> Option<Self>; } impl SafeAdd for usize { fn safe_add(&self, n: &Self) -> Option<Self> { self.checked_add(*n) } } pub fn safe_add<T, F, E>(dst: &mut T, src: &T, f: F) -> Result<(), E> where T: SafeAdd, F: Fn() -> E, { if let Som...
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch09/linz/src/typing.rs
ch09/linz/src/typing.rs
use crate::{helper::safe_add, parser}; use std::{borrow::Cow, cmp::Ordering, collections::BTreeMap, mem}; type VarToType = BTreeMap<String, Option<parser::TypeExpr>>; /// 型環境 #[derive(Debug, Clone, Eq, PartialEq)] pub struct TypeEnv { env_lin: TypeEnvStack, // lin用 env_un: TypeEnvStack, // un用 } impl TypeEn...
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch09/linz/src/main.rs
ch09/linz/src/main.rs
mod helper; mod parser; mod typing; use nom::error::convert_error; use std::{env, error::Error, fs}; fn main() -> Result<(), Box<dyn Error>> { // コマンドライン引数の検査 let args: Vec<String> = env::args().collect(); if args.len() < 2 { eprintln!("以下のようにファイル名を指定して実行してください\ncargo run codes/ex1.lin"); ...
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch09/parser/src/main.rs
ch09/parser/src/main.rs
//! # 逆ポーランド記法計算機 //! //! パーサコンビネータのnomの説明のコード。 //! //! 以下のようなBNFをパースし、実行する。 //! //! ```text //! <EXPR> := <NUM> | <ADD> <EXPR> <EXPR | <MUL> <EXPR> <EXPR> //! ``` use nom::{ branch::alt, character::complete::{char, one_of}, error::ErrorKind, multi::{many0, many1}, IResult, }; use rustyline::Editor;...
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch07/zrsh/src/shell.rs
ch07/zrsh/src/shell.rs
use crate::helper::DynError; use nix::{ libc, sys::{ signal::{killpg, signal, SigHandler, Signal}, wait::{waitpid, WaitPidFlag, WaitStatus}, }, unistd::{self, dup2, execvp, fork, pipe, setpgid, tcgetpgrp, tcsetpgrp, ForkResult, Pid}, }; use rustyline::{error::ReadlineError, Editor}; use ...
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch07/zrsh/src/helper.rs
ch07/zrsh/src/helper.rs
pub type DynError = Box<dyn std::error::Error + Send + Sync + 'static>;
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch07/zrsh/src/main.rs
ch07/zrsh/src/main.rs
mod helper; mod shell; use helper::DynError; const HISTORY_FILE: &str = ".zerosh_history"; fn main() -> Result<(), DynError> { let mut logfile = HISTORY_FILE; let mut home = dirs::home_dir(); if let Some(h) = &mut home { h.push(HISTORY_FILE); logfile = h.to_str().unwrap_or(HISTORY_FILE); ...
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch01/mul/src/main.rs
ch01/mul/src/main.rs
// mainという関数を定義 fn main() { let x: i32 = 10; // i32型の変数をxを定義して、10を代入(型指定あり) let y = 20; // 変数yを定義して20を代入(型指定なし) let z = mul(x, y); // 関数呼び出し println!("z = {z}"); // {z}で変数zを表示 } // i32型の引数xとyを受け取り、i32型の値を返す関数mulを定義 fn mul(x: i32, y: i32) -> i32 { // セミコロンが最後にないことに注意 // 関数の最後の値が返り値となる x * y ...
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex3/src/main.rs
ch05/mod_ex3/src/main.rs
mod a; mod b; fn main() {}
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex3/src/a/a_2.rs
ch05/mod_ex3/src/a/a_2.rs
struct TypeA2;
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex3/src/a/a_1.rs
ch05/mod_ex3/src/a/a_1.rs
struct TypeA1;
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex3/src/a/mod.rs
ch05/mod_ex3/src/a/mod.rs
mod a_1; mod a_2; struct TypeA;
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex3/src/b/b_1.rs
ch05/mod_ex3/src/b/b_1.rs
struct TypeB1;
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex3/src/b/b_2.rs
ch05/mod_ex3/src/b/b_2.rs
struct TypeB2;
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false
ytakano/rust_zero
https://github.com/ytakano/rust_zero/blob/843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c/ch05/mod_ex3/src/b/mod.rs
ch05/mod_ex3/src/b/mod.rs
mod b_1; mod b_2; struct TypeB;
rust
MIT
843eb4cf9b2dff3b24defc4ada1f04a58a8efe6c
2026-01-04T20:20:39.285647Z
false