Skip to content

Commit

Permalink
embedded docs, cubeb for linux audio
Browse files Browse the repository at this point in the history
  • Loading branch information
Lochlan Wansbrough committed Oct 6, 2024
1 parent ca41fd3 commit ae0cb83
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ wit-parser = "0.216.0"
tui-widget-list = "0.12.1"
self-replace = "1.5.0"
tempfile = { version = "3.12.0" }
rust-embed = "8.5.0"

[build-dependencies]
vergen = { version = "8.2.6", features = [ "build", "git", "gitoxide", "cargo" ]}
Expand Down
2 changes: 1 addition & 1 deletion crates/rune/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ gilrs = "0.10.2"
vfs = "0.10.0"
termcolor = "1.3.0"
gdbstub = "0.7.1"
web-audio-api = "0.45.2"
web-audio-api = { version = "0.45.2", features = ["cubeb"] }
libtest-mimic = "0.7.3"
wasi = "0.13.2"

Expand Down
14 changes: 12 additions & 2 deletions src/commands/docs/docs.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
use std::{
collections::{HashMap, VecDeque}, path::Path, time::{Duration, SystemTime, UNIX_EPOCH}
};
use rust_embed::Embed;

use color_eyre::{eyre::Result, owo_colors::OwoColorize};
use crossterm::event::{KeyCode, KeyEvent, MouseEvent};
use ratatui::{prelude::*, widgets::*};
use serde::{Deserialize, Serialize};
use tokio::sync::mpsc::UnboundedSender;
use tui_widget_list::{ListBuilder, ListState, ListView};
use wit_parser::{Function, FunctionKind, Interface, InterfaceId, Type, TypeDef, TypeId, UnresolvedPackage, UnresolvedPackageGroup};
use wit_parser::{Function, FunctionKind, Interface, InterfaceId, SourceMap, Type, TypeDef, TypeId, UnresolvedPackage, UnresolvedPackageGroup};

use crate::{
action::Action, components::Component, config::{Config, KeyBindings}, tui::Event
};

#[derive(Embed)]
#[folder = "crates/rune/wit/runtime"]
struct RuneWit;

#[derive(Clone)]
pub enum CurrentItem {
Package(UnresolvedPackage),
Expand Down Expand Up @@ -287,7 +292,12 @@ impl Docs {

impl Default for Docs {
fn default() -> Self {
let package_group = UnresolvedPackageGroup::parse_dir(Path::new("/Users/loch/Documents/Projects/wizard/rune/wit/runtime")).unwrap();
let mut source_map = SourceMap::new();
for wit_name in RuneWit::iter() {
let wit = RuneWit::get(&wit_name).unwrap();
source_map.push(Path::new(wit_name.as_ref()), std::str::from_utf8(&wit.data).unwrap());
}
let package_group = source_map.parse().unwrap();

let mut visited = VecDeque::new();
visited.push_back(CurrentItem::Package(package_group.main));
Expand Down

0 comments on commit ae0cb83

Please sign in to comment.