Compare commits
2 Commits
b10fc30984
...
668a91941b
Author | SHA1 | Date | |
---|---|---|---|
668a91941b | |||
|
0eaf238735 |
@ -9,7 +9,9 @@ async fn main() {
|
|||||||
let router = get_router(assets_path.as_path());
|
let router = get_router(assets_path.as_path());
|
||||||
|
|
||||||
// TODO: select port based on available port (or ask in CLI)
|
// TODO: select port based on available port (or ask in CLI)
|
||||||
let listener = tokio::net::TcpListener::bind("localhost:3000").await.unwrap();
|
let listener = tokio::net::TcpListener::bind("localhost:3000")
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
println!("Listening on: http://{}", listener.local_addr().unwrap());
|
println!("Listening on: http://{}", listener.local_addr().unwrap());
|
||||||
axum::serve(listener, router).await.unwrap();
|
axum::serve(listener, router).await.unwrap();
|
||||||
}
|
}
|
||||||
|
@ -7,4 +7,4 @@ struct CpsResponse;
|
|||||||
|
|
||||||
pub async fn cps() -> impl IntoResponse {
|
pub async fn cps() -> impl IntoResponse {
|
||||||
CpsResponse.into_response()
|
CpsResponse.into_response()
|
||||||
}
|
}
|
||||||
|
@ -7,4 +7,4 @@ struct HomeResponse;
|
|||||||
|
|
||||||
pub async fn home() -> impl IntoResponse {
|
pub async fn home() -> impl IntoResponse {
|
||||||
HomeResponse.into_response()
|
HomeResponse.into_response()
|
||||||
}
|
}
|
||||||
|
@ -7,4 +7,4 @@ pub fn get_routes() -> Router {
|
|||||||
Router::new()
|
Router::new()
|
||||||
.route("/home", routing::get(home::home))
|
.route("/home", routing::get(home::home))
|
||||||
.route("/cps", routing::get(cps::cps))
|
.route("/cps", routing::get(cps::cps))
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,10 @@ struct HelloResponse {
|
|||||||
async fn hello() -> impl IntoResponse {
|
async fn hello() -> impl IntoResponse {
|
||||||
HelloResponse {
|
HelloResponse {
|
||||||
name: "Theo".to_string(),
|
name: "Theo".to_string(),
|
||||||
}.into_response()
|
}
|
||||||
|
.into_response()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_routes() -> Router {
|
pub fn get_routes() -> Router {
|
||||||
Router::new()
|
Router::new().route("/", routing::get(hello))
|
||||||
.route("/", routing::get(hello))
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,9 @@ impl MenuResponse {
|
|||||||
fn get_classes(&self, is_current_item: &bool) -> String {
|
fn get_classes(&self, is_current_item: &bool) -> String {
|
||||||
let common_classes = match self.mobile {
|
let common_classes = match self.mobile {
|
||||||
true => "block border-l-4 py-2 pl-3 pr-4 text-base font-medium".to_string(),
|
true => "block border-l-4 py-2 pl-3 pr-4 text-base font-medium".to_string(),
|
||||||
false => "inline-flex items-center border-b-2 px-1 pt-1 text-sm font-medium".to_string(),
|
false => {
|
||||||
|
"inline-flex items-center border-b-2 px-1 pt-1 text-sm font-medium".to_string()
|
||||||
|
}
|
||||||
};
|
};
|
||||||
match (self.mobile, is_current_item) {
|
match (self.mobile, is_current_item) {
|
||||||
(true, true) => common_classes + " border-indigo-500 bg-indigo-50 text-indigo-700",
|
(true, true) => common_classes + " border-indigo-500 bg-indigo-50 text-indigo-700",
|
||||||
@ -50,11 +52,11 @@ async fn menu(Query(params): Query<MenuParameters>) -> impl IntoResponse {
|
|||||||
href: "/pages/cps".to_string(),
|
href: "/pages/cps".to_string(),
|
||||||
current: false,
|
current: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}.into_response()
|
}
|
||||||
|
.into_response()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_routes() -> Router {
|
pub fn get_routes() -> Router {
|
||||||
Router::new()
|
Router::new().route("/menu", routing::get(menu))
|
||||||
.route("/menu", routing::get(menu))
|
|
||||||
}
|
}
|
||||||
|
@ -56,10 +56,10 @@ async fn menu(Query(params): Query<MenuParameters>) -> impl IntoResponse {
|
|||||||
current: false,
|
current: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}.into_response()
|
}
|
||||||
|
.into_response()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_routes() -> Router {
|
pub fn get_routes() -> Router {
|
||||||
Router::new()
|
Router::new().route("/menu", routing::get(menu))
|
||||||
.route("/menu", routing::get(menu))
|
}
|
||||||
}
|
|
||||||
|
@ -16,7 +16,10 @@ fn main() {
|
|||||||
|
|
||||||
// Add local lib directory to the linker search path (for def files and static libs)
|
// Add local lib directory to the linker search path (for def files and static libs)
|
||||||
let static_lib_path = manifest_path.join("lib");
|
let static_lib_path = manifest_path.join("lib");
|
||||||
println!("cargo::rustc-link-search=native={}", static_lib_path.display());
|
println!(
|
||||||
|
"cargo::rustc-link-search=native={}",
|
||||||
|
static_lib_path.display()
|
||||||
|
);
|
||||||
|
|
||||||
// Add the SESAM_FSV_LIB_PATH to the linker search path
|
// Add the SESAM_FSV_LIB_PATH to the linker search path
|
||||||
let fsv_lib_path = PathBuf::from(env::var("SESAM_FSV_LIB_PATH").unwrap());
|
let fsv_lib_path = PathBuf::from(env::var("SESAM_FSV_LIB_PATH").unwrap());
|
||||||
@ -31,6 +34,9 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Link the SESAM_FSV_SSVLIB dynamic library
|
// Link the SESAM_FSV_SSVLIB dynamic library
|
||||||
println!("cargo::rustc-link-lib=dylib={}", env::var("SESAM_FSV_SSVLIB").unwrap());
|
println!(
|
||||||
|
"cargo::rustc-link-lib=dylib={}",
|
||||||
|
env::var("SESAM_FSV_SSVLIB").unwrap()
|
||||||
|
);
|
||||||
// TODO : try `raw-dylib` instead of `dylib` on Windows to avoid the need of the `lib` headers compiled from the `def`
|
// TODO : try `raw-dylib` instead of `dylib` on Windows to avoid the need of the `lib` headers compiled from the `def`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user