Compare commits

..

No commits in common. "b15770316238b0722bc8001cb941b3b345333f37" and "abfdea2e78d2aaf31b4372c6dffe3f9f8d7dcff9" have entirely different histories.

5 changed files with 9 additions and 19 deletions

2
Cargo.lock generated
View File

@ -1367,7 +1367,7 @@ dependencies = [
[[package]] [[package]]
name = "karnaugh" name = "karnaugh"
version = "0.1.1" version = "0.1.0"
dependencies = [ dependencies = [
"axum", "axum",
"clap", "clap",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "karnaugh" name = "karnaugh"
version = "0.1.1" version = "0.1.0"
edition = "2024" edition = "2024"
[dependencies] [dependencies]

View File

@ -21,9 +21,9 @@
rec { rec {
packages.karnaugh = pkgs.rustPlatform.buildRustPackage (final: { packages.karnaugh = pkgs.rustPlatform.buildRustPackage (final: {
pname = "karnaugh"; pname = "karnaugh";
version = "0.1.1"; version = "0.1.0";
src = self; src = self;
cargoHash = "sha256-LqPV818AKVQR5ihE3xkEduLhsxvN5m21M8H/AVWBXTU="; cargoHash = "sha256-4jmvuQiQz5TCkY//L2qyx0AiDTxHu8EocFfysgaTaHU=";
}); });
packages.container = pkgs.dockerTools.buildImage { packages.container = pkgs.dockerTools.buildImage {
name = "karnaugh"; name = "karnaugh";

View File

@ -108,12 +108,8 @@ async fn main() {
let socket = SocketAddrV4::new(Ipv4Addr::new(0, 0, 0, 0), state.config.port); let socket = SocketAddrV4::new(Ipv4Addr::new(0, 0, 0, 0), state.config.port);
info!("Serving Karnaugh on socket {}", socket); info!("Serving Karnaugh on socket {}", socket);
let listener = tokio::net::TcpListener::bind(socket) let listener = tokio::net::TcpListener::bind(socket).await.unwrap();
.await axum::serve(listener, app).await.unwrap();
.expect(&format!("Failed to bind to socket {}", socket));
axum::serve(listener, app)
.await
.expect("Failed to serve site");
} }
async fn root_handler(State(state): State<AppState>) -> impl IntoResponse { async fn root_handler(State(state): State<AppState>) -> impl IntoResponse {

View File

@ -138,10 +138,7 @@ impl<'a> DocumentWorld<'a> {
} }
fn get_package(&self, spec: &PackageSpec) -> PackageResult<PathBuf> { fn get_package(&self, spec: &PackageSpec) -> PackageResult<PathBuf> {
let path = get_package_path( let path = get_package_path(&VirtualPath::new("").unwrap(), spec);
&VirtualPath::new("").expect("Failed to create empty virtual path"),
spec,
);
let path = path.realize(&self.context.config.packages_root); let path = path.realize(&self.context.config.packages_root);
if path.exists() { if path.exists() {
@ -180,9 +177,6 @@ impl<'a> DocumentWorld<'a> {
} }
fn get_package_path(file_path: &VirtualPath, spec: &PackageSpec) -> VirtualPath { fn get_package_path(file_path: &VirtualPath, spec: &PackageSpec) -> VirtualPath {
let package_path = VirtualPath::new(format!("{}/{}", spec.name, spec.version)) let package_path = VirtualPath::new(format!("{}/{}", spec.name, spec.version)).unwrap();
.expect("Failed to create virtual path representing package path."); package_path.join(file_path.get_without_slash()).unwrap()
package_path
.join(file_path.get_without_slash())
.expect("Failed to join file path into package path.")
} }