(feat): rename example-usage to just example
Some checks failed
CI / rustfmt (push) Successful in 17s
CI / clippy (push) Failing after 1m16s
CI / wasm build (push) Successful in 1m17s
CI / example (push) Successful in 1m29s
CI / test (push) Successful in 1m49s
CI / duplicate code (push) Successful in 12s
CI / web client (push) Failing after 27s
CI / cargo-machete (push) Successful in 1m10s
CI / cargo-deny (push) Failing after 2m20s
Some checks failed
CI / rustfmt (push) Successful in 17s
CI / clippy (push) Failing after 1m16s
CI / wasm build (push) Successful in 1m17s
CI / example (push) Successful in 1m29s
CI / test (push) Successful in 1m49s
CI / duplicate code (push) Successful in 12s
CI / web client (push) Failing after 27s
CI / cargo-machete (push) Successful in 1m10s
CI / cargo-deny (push) Failing after 2m20s
(feat): add the example's web-client dist folder to a gitignore (fix): format issues (fix): a lot of duplicate code
This commit is contained in:
parent
22245e673d
commit
89a20044a5
43 changed files with 528 additions and 1619 deletions
|
|
@ -123,10 +123,7 @@ const RESERVED_DATA_TYPES: &[ReservedEntry] = &[
|
|||
name: "Version",
|
||||
id: 0,
|
||||
},
|
||||
ReservedEntry {
|
||||
name: "Id",
|
||||
id: 1,
|
||||
},
|
||||
ReservedEntry { name: "Id", id: 1 },
|
||||
ReservedEntry {
|
||||
name: "ClientNonce",
|
||||
id: 2,
|
||||
|
|
@ -275,18 +272,7 @@ fn generate(config: &Config, multi_version: bool) -> String {
|
|||
}
|
||||
|
||||
fn generate_protocol_version(out: &mut String, config: &Config) {
|
||||
let (major, minor) = if config.protocol_version.is_empty() {
|
||||
(0, 0)
|
||||
} else {
|
||||
let parts: Vec<&str> = config.protocol_version.split('.').collect();
|
||||
if parts.len() == 2 {
|
||||
let maj = parts[0].parse::<u16>().unwrap_or(0);
|
||||
let min = parts[1].parse::<u16>().unwrap_or(0);
|
||||
(maj, min)
|
||||
} else {
|
||||
(0, 0)
|
||||
}
|
||||
};
|
||||
let (major, minor) = parse_protocol_version(&config.protocol_version);
|
||||
writeln!(
|
||||
out,
|
||||
"pub const PROTOCOL_VERSION: Version = Version({}, {});",
|
||||
|
|
@ -297,18 +283,7 @@ fn generate_protocol_version(out: &mut String, config: &Config) {
|
|||
}
|
||||
|
||||
fn generate_latest_method(out: &mut String, config: &Config) {
|
||||
let (major, minor) = if config.protocol_version.is_empty() {
|
||||
(0, 0)
|
||||
} else {
|
||||
let parts: Vec<&str> = config.protocol_version.split('.').collect();
|
||||
if parts.len() == 2 {
|
||||
let maj = parts[0].parse::<u16>().unwrap_or(0);
|
||||
let min = parts[1].parse::<u16>().unwrap_or(0);
|
||||
(maj, min)
|
||||
} else {
|
||||
(0, 0)
|
||||
}
|
||||
};
|
||||
let (major, minor) = parse_protocol_version(&config.protocol_version);
|
||||
writeln!(out, "impl TypeMap {{").unwrap();
|
||||
writeln!(out, " pub fn latest() -> Self {{").unwrap();
|
||||
writeln!(
|
||||
|
|
@ -322,6 +297,17 @@ fn generate_latest_method(out: &mut String, config: &Config) {
|
|||
writeln!(out).unwrap();
|
||||
}
|
||||
|
||||
fn parse_protocol_version(version: &str) -> (u16, u16) {
|
||||
let Some((major, minor)) = version.split_once('.') else {
|
||||
return (0, 0);
|
||||
};
|
||||
|
||||
(
|
||||
major.parse::<u16>().unwrap_or(0),
|
||||
minor.parse::<u16>().unwrap_or(0),
|
||||
)
|
||||
}
|
||||
|
||||
fn generate_comm_type_enum(out: &mut String, user_names: &BTreeSet<&str>) {
|
||||
writeln!(
|
||||
out,
|
||||
|
|
|
|||
Loading…
Reference in a new issue