Update to work with polariton v0.2

This commit is contained in:
NGnius (Graham) committed 2025-03-08 17:16:02 -05:00
1 parent f004ca8565
commit be37f8913a
83 files changed
+428 -1202

No files matched your search

+15 -15
View File
@@ -1,51 +1,51 @@
use std::collections::HashMap;
use polariton::operation::{Typed, ParameterTable, OperationResponse, Dict};
use polariton::{operation::{Dict, OperationResponse, ParameterTable, Typed}, serdes::TypePrefix};
use polariton_server::operations::{Operation, OperationCode};
pub struct QualityConfigTeller;
impl Operation for QualityConfigTeller {
impl <C> Operation<C> for QualityConfigTeller {
type State = ();
type User = crate::UserTy;
fn handle(&self, _: ParameterTable, _: &mut Self::State, _: &Self::User) -> OperationResponse {
fn handle(&self, _: ParameterTable<C>, _: &mut Self::State, _: &Self::User) -> OperationResponse<C> {
let quality_levels = Typed::HashMap(vec![
(Typed::Str("extremLow".into()), Typed::Dict(Dict {
key_ty: 115,
val_ty: 42,
key_ty: TypePrefix::Str,
val_ty: TypePrefix::Any,
items: vec![
(Typed::Str("Level".into()), Typed::Long(0)),
(Typed::Str("default".into()), Typed::Float(0.0)),
],
})),
(Typed::Str("low".into()), Typed::Dict(Dict {
key_ty: 115,
val_ty: 42,
key_ty: TypePrefix::Str,
val_ty: TypePrefix::Any,
items: vec![
(Typed::Str("Level".into()), Typed::Long(1)),
(Typed::Str("default".into()), Typed::Float(0.0)),
],
})),
(Typed::Str("normal".into()), Typed::Dict(Dict {
key_ty: 115,
val_ty: 42,
key_ty: TypePrefix::Str,
val_ty: TypePrefix::Any,
items: vec![
(Typed::Str("Level".into()), Typed::Long(2)),
(Typed::Str("default".into()), Typed::Float(0.0)),
],
})),
(Typed::Str("beautiful".into()), Typed::Dict(Dict {
key_ty: 115,
val_ty: 42,
key_ty: TypePrefix::Str,
val_ty: TypePrefix::Any,
items: vec![
(Typed::Str("Level".into()), Typed::Long(3)),
(Typed::Str("default".into()), Typed::Float(0.0)),
],
})),
(Typed::Str("fantastic".into()), Typed::Dict(Dict {
key_ty: 115,
val_ty: 42,
key_ty: TypePrefix::Str,
val_ty: TypePrefix::Any,
items: vec![
(Typed::Str("Level".into()), Typed::Long(4)),
(Typed::Str("default".into()), Typed::Float(f32::MAX)),
@@ -59,8 +59,8 @@ impl Operation for QualityConfigTeller {
let mut resp_params = HashMap::new();
resp_params.insert(1 /* dict<string, hashtable> */, Typed::Dict(
Dict {
key_ty: 115, // str
val_ty: 104, // hash table
key_ty: TypePrefix::Str, // str
val_ty: TypePrefix::HashMap, // hash table
items: vec![
(Typed::Str("qualityLevels".into()), quality_levels),
(Typed::Str("systemMemoryThresholds".into()), mem_thresholds),