From 6b00582a453d2c51cc48a63d7d6f68aaee6e833d Mon Sep 17 00:00:00 2001 From: Aleh Zasypkin Date: Sun, 15 Jan 2023 14:09:42 +0100 Subject: [PATCH] Update dependencies and regenerate protobuf-related code. --- .gitignore | 1 - Cargo.lock | 628 +++++++++++++++++ Cargo.toml | 20 +- README.md | 2 +- build.rs | 9 +- examples/rust_caster.rs | 2 +- rustfmt.toml | 2 + src/cast/authority_keys.rs | 429 +++++------- src/cast/cast_channel.rs | 1302 +++++++++++++++--------------------- src/cast/proxies.rs | 7 + src/channels/receiver.rs | 10 +- src/errors.rs | 15 +- src/lib.rs | 40 +- src/message_manager.rs | 35 +- 14 files changed, 1441 insertions(+), 1061 deletions(-) create mode 100644 Cargo.lock create mode 100644 rustfmt.toml diff --git a/.gitignore b/.gitignore index af39a9fa3..13f61c083 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ target out *.iml -Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 000000000..066dd5b1a --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,628 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "cc" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "docopt" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f3f119846c823f9eafcf953a8f6ffb6ed69bf6240883261a7f13b634579a51f" +dependencies = [ + "lazy_static", + "regex", + "serde", + "strsim", +] + +[[package]] +name = "either" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" + +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "fastrand" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +dependencies = [ + "instant", +] + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +dependencies = [ + "hermit-abi", + "io-lifetimes", + "rustix", + "windows-sys", +] + +[[package]] +name = "itoa" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "once_cell" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" + +[[package]] +name = "openssl" +version = "0.10.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-sys" +version = "0.9.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "pkg-config" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" + +[[package]] +name = "proc-macro2" +version = "1.0.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "protobuf" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55bad9126f378a853655831eb7363b7b01b81d19f8cb1218861086ca4a1a61e" +dependencies = [ + "once_cell", + "protobuf-support", + "thiserror", +] + +[[package]] +name = "protobuf-codegen" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd418ac3c91caa4032d37cb80ff0d44e2ebe637b2fb243b6234bf89cdac4901" +dependencies = [ + "anyhow", + "once_cell", + "protobuf", + "protobuf-parse", + "regex", + "tempfile", + "thiserror", +] + +[[package]] +name = "protobuf-parse" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d39b14605eaa1f6a340aec7f320b34064feb26c93aec35d6a9a2272a8ddfa49" +dependencies = [ + "anyhow", + "indexmap", + "log", + "protobuf", + "protobuf-support", + "tempfile", + "thiserror", + "which", +] + +[[package]] +name = "protobuf-support" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5d4d7b8601c814cfb36bcebb79f0e61e45e1e93640cf778837833bbed05c372" +dependencies = [ + "thiserror", +] + +[[package]] +name = "quote" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "rust_cast" +version = "0.18.0" +dependencies = [ + "ansi_term", + "byteorder", + "docopt", + "env_logger", + "log", + "openssl", + "protobuf", + "protobuf-codegen", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "rustix" +version = "0.36.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "ryu" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" + +[[package]] +name = "serde" +version = "1.0.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.152" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "syn" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if", + "fastrand", + "libc", + "redox_syscall", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "unicode-ident" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "which" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +dependencies = [ + "either", + "libc", + "once_cell", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" diff --git a/Cargo.toml b/Cargo.toml index a255026c1..70e6905e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ repository = "https://github.com/azasypkin/rust-cast" readme = "README.md" license = "MIT" keywords = ["cast", "chromecast", "google"] -version = "0.17.0" +version = "0.18.0" authors = ["Aleh Zasypkin "] categories = ["api-bindings", "hardware-support", "multimedia"] edition = "2021" @@ -19,20 +19,20 @@ exclude = [ [dependencies] byteorder = "1.4.3" -log = "0.4.14" -openssl = "0.10.38" -protobuf = "=2.27.1" -serde = "1.0.136" -serde_derive = "1.0.136" -serde_json = "1.0.79" +log = "0.4.17" +openssl = "0.10.45" +protobuf = "=3.2.0" +serde = "1.0.152" +serde_derive = "1.0.152" +serde_json = "1.0.91" [dev-dependencies] ansi_term = "0.12.1" docopt = "1.1.1" -env_logger = "0.9.0" +env_logger = "0.10.0" [build-dependencies] -protoc-rust = "=2.27.1" +protobuf-codegen = "=3.2.0" [features] -thread_safe = [] \ No newline at end of file +thread_safe = [] diff --git a/README.md b/README.md index e981f8195..c7c6d1626 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![Build Status](https://github.com/azasypkin/rust-cast/actions/workflows/ci.yml/badge.svg) # Usage -* [Documentation](https://azasypkin.github.io/rust-cast/) +* [Documentation](https://docs.rs/crate/rust_cast/) * Try out [Rust Caster](./examples/rust_caster.rs) example to see this crate in action! # Build diff --git a/build.rs b/build.rs index 7d9895efc..eff94c8c8 100644 --- a/build.rs +++ b/build.rs @@ -1,16 +1,17 @@ +use protobuf_codegen::{Codegen, Customize}; use std::env; -extern crate protoc_rust; fn main() { let generate_proto = env::var("GENERATE_PROTO").unwrap_or_else(|_| "false".to_string()); if generate_proto == "true" { - protoc_rust::Codegen::new() + Codegen::new() .out_dir("src/cast") - .inputs(&[ + .inputs([ "protobuf/authority_keys.proto", "protobuf/cast_channel.proto", ]) - .includes(&["protobuf"]) + .includes(["protobuf"]) + .customize(Customize::default().gen_mod_rs(false)) .run() .expect("protoc"); } diff --git a/examples/rust_caster.rs b/examples/rust_caster.rs index f3c3a21d3..67a318299 100644 --- a/examples/rust_caster.rs +++ b/examples/rust_caster.rs @@ -459,7 +459,7 @@ fn main() { // Play media and keep connection. if let Some(media) = args.flag_media { - let media_type = args.flag_media_type.unwrap_or_else(|| "".to_string()); + let media_type = args.flag_media_type.unwrap_or_default(); let media_stream_type = match args.flag_media_stream_type.as_str() { value @ "buffered" | value @ "live" | value @ "none" => { diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 000000000..529356010 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,2 @@ +unstable_features = true +imports_granularity = "Crate" diff --git a/src/cast/authority_keys.rs b/src/cast/authority_keys.rs index 7194bf8b3..f7dd599e7 100644 --- a/src/cast/authority_keys.rs +++ b/src/cast/authority_keys.rs @@ -1,4 +1,5 @@ -// This file is generated by rust-protobuf 2.27.1. Do not edit +// This file is generated by rust-protobuf 3.2.0. Do not edit +// .proto file is parsed by protoc 3.21.12 // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -15,21 +16,25 @@ #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] -#![allow(unused_imports)] #![allow(unused_results)] +#![allow(unused_mut)] + //! Generated file from `authority_keys.proto` +// Generated for lite runtime /// Generated files are compatible only with the same version /// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_27_1; +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_2_0; #[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:cast.channel.AuthorityKeys) pub struct AuthorityKeys { // message fields - pub keys: ::protobuf::RepeatedField, + // @@protoc_insertion_point(field:cast.channel.AuthorityKeys.keys) + pub keys: ::std::vec::Vec, // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, + // @@protoc_insertion_point(special_field:cast.channel.AuthorityKeys.special_fields) + pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AuthorityKeys { @@ -42,34 +47,11 @@ impl AuthorityKeys { pub fn new() -> AuthorityKeys { ::std::default::Default::default() } - - // repeated .cast.channel.AuthorityKeys.Key keys = 1; - - - pub fn get_keys(&self) -> &[AuthorityKeys_Key] { - &self.keys - } - pub fn clear_keys(&mut self) { - self.keys.clear(); - } - - // Param is passed by value, moved - pub fn set_keys(&mut self, v: ::protobuf::RepeatedField) { - self.keys = v; - } - - // Mutable pointer to the field. - pub fn mut_keys(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.keys - } - - // Take field - pub fn take_keys(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.keys, ::protobuf::RepeatedField::new()) - } } impl ::protobuf::Message for AuthorityKeys { + const NAME: &'static str = "AuthorityKeys"; + fn is_initialized(&self) -> bool { for v in &self.keys { if !v.is_initialized() { @@ -79,15 +61,14 @@ impl ::protobuf::Message for AuthorityKeys { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.keys)?; + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.keys.push(is.read_message()?); }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } @@ -96,271 +77,231 @@ impl ::protobuf::Message for AuthorityKeys { // Compute sizes of nested messages #[allow(unused_variables)] - fn compute_size(&self) -> u32 { + fn compute_size(&self) -> u64 { let mut my_size = 0; for value in &self.keys { let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; }; - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { for v in &self.keys { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; }; - os.write_unknown_fields(self.get_unknown_fields())?; + os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } - fn get_cached_size(&self) -> u32 { - self.cached_size.get() + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields } - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields } fn new() -> AuthorityKeys { AuthorityKeys::new() } - fn default_instance() -> &'static AuthorityKeys { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(AuthorityKeys::new) - } -} - -impl ::protobuf::Clear for AuthorityKeys { fn clear(&mut self) { self.keys.clear(); - self.unknown_fields.clear(); - } -} - -impl ::protobuf::reflect::ProtobufValue for AuthorityKeys { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) + self.special_fields.clear(); } -} - -#[derive(PartialEq,Clone,Default,Debug)] -pub struct AuthorityKeys_Key { - // message fields - fingerprint: ::protobuf::SingularField<::std::vec::Vec>, - public_key: ::protobuf::SingularField<::std::vec::Vec>, - // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, -} -impl<'a> ::std::default::Default for &'a AuthorityKeys_Key { - fn default() -> &'a AuthorityKeys_Key { - ::default_instance() + fn default_instance() -> &'static AuthorityKeys { + static instance: AuthorityKeys = AuthorityKeys { + keys: ::std::vec::Vec::new(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance } } -impl AuthorityKeys_Key { - pub fn new() -> AuthorityKeys_Key { - ::std::default::Default::default() - } - - // required bytes fingerprint = 1; - - - pub fn get_fingerprint(&self) -> &[u8] { - match self.fingerprint.as_ref() { - Some(v) => &v, - None => &[], +/// Nested message and enums of message `AuthorityKeys` +pub mod authority_keys { + #[derive(PartialEq,Clone,Default,Debug)] + // @@protoc_insertion_point(message:cast.channel.AuthorityKeys.Key) + pub struct Key { + // message fields + // @@protoc_insertion_point(field:cast.channel.AuthorityKeys.Key.fingerprint) + pub fingerprint: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:cast.channel.AuthorityKeys.Key.public_key) + pub public_key: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:cast.channel.AuthorityKeys.Key.special_fields) + pub special_fields: ::protobuf::SpecialFields, + } + + impl<'a> ::std::default::Default for &'a Key { + fn default() -> &'a Key { + ::default_instance() } } - pub fn clear_fingerprint(&mut self) { - self.fingerprint.clear(); - } - pub fn has_fingerprint(&self) -> bool { - self.fingerprint.is_some() - } - - // Param is passed by value, moved - pub fn set_fingerprint(&mut self, v: ::std::vec::Vec) { - self.fingerprint = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_fingerprint(&mut self) -> &mut ::std::vec::Vec { - if self.fingerprint.is_none() { - self.fingerprint.set_default(); + impl Key { + pub fn new() -> Key { + ::std::default::Default::default() } - self.fingerprint.as_mut().unwrap() - } - // Take field - pub fn take_fingerprint(&mut self) -> ::std::vec::Vec { - self.fingerprint.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } + // required bytes fingerprint = 1; - // required bytes public_key = 2; + pub fn fingerprint(&self) -> &[u8] { + match self.fingerprint.as_ref() { + Some(v) => v, + None => &[], + } + } + pub fn clear_fingerprint(&mut self) { + self.fingerprint = ::std::option::Option::None; + } - pub fn get_public_key(&self) -> &[u8] { - match self.public_key.as_ref() { - Some(v) => &v, - None => &[], + pub fn has_fingerprint(&self) -> bool { + self.fingerprint.is_some() } - } - pub fn clear_public_key(&mut self) { - self.public_key.clear(); - } - pub fn has_public_key(&self) -> bool { - self.public_key.is_some() - } + // Param is passed by value, moved + pub fn set_fingerprint(&mut self, v: ::std::vec::Vec) { + self.fingerprint = ::std::option::Option::Some(v); + } - // Param is passed by value, moved - pub fn set_public_key(&mut self, v: ::std::vec::Vec) { - self.public_key = ::protobuf::SingularField::some(v); - } + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_fingerprint(&mut self) -> &mut ::std::vec::Vec { + if self.fingerprint.is_none() { + self.fingerprint = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.fingerprint.as_mut().unwrap() + } - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { - if self.public_key.is_none() { - self.public_key.set_default(); + // Take field + pub fn take_fingerprint(&mut self) -> ::std::vec::Vec { + self.fingerprint.take().unwrap_or_else(|| ::std::vec::Vec::new()) } - self.public_key.as_mut().unwrap() - } - // Take field - pub fn take_public_key(&mut self) -> ::std::vec::Vec { - self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) - } -} + // required bytes public_key = 2; -impl ::protobuf::Message for AuthorityKeys_Key { - fn is_initialized(&self) -> bool { - if self.fingerprint.is_none() { - return false; - } - if self.public_key.is_none() { - return false; + pub fn public_key(&self) -> &[u8] { + match self.public_key.as_ref() { + Some(v) => v, + None => &[], + } } - true - } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.fingerprint)?; - }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.public_key)?; - }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; - }, - }; + pub fn clear_public_key(&mut self) { + self.public_key = ::std::option::Option::None; } - ::std::result::Result::Ok(()) - } - // Compute sizes of nested messages - #[allow(unused_variables)] - fn compute_size(&self) -> u32 { - let mut my_size = 0; - if let Some(ref v) = self.fingerprint.as_ref() { - my_size += ::protobuf::rt::bytes_size(1, &v); + pub fn has_public_key(&self) -> bool { + self.public_key.is_some() } - if let Some(ref v) = self.public_key.as_ref() { - my_size += ::protobuf::rt::bytes_size(2, &v); + + // Param is passed by value, moved + pub fn set_public_key(&mut self, v: ::std::vec::Vec) { + self.public_key = ::std::option::Option::Some(v); } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); - my_size - } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.fingerprint.as_ref() { - os.write_bytes(1, &v)?; + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_public_key(&mut self) -> &mut ::std::vec::Vec { + if self.public_key.is_none() { + self.public_key = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.public_key.as_mut().unwrap() } - if let Some(ref v) = self.public_key.as_ref() { - os.write_bytes(2, &v)?; + + // Take field + pub fn take_public_key(&mut self) -> ::std::vec::Vec { + self.public_key.take().unwrap_or_else(|| ::std::vec::Vec::new()) } - os.write_unknown_fields(self.get_unknown_fields())?; - ::std::result::Result::Ok(()) } - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } + impl ::protobuf::Message for Key { + const NAME: &'static str = "Key"; - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } + fn is_initialized(&self) -> bool { + if self.fingerprint.is_none() { + return false; + } + if self.public_key.is_none() { + return false; + } + true + } - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.fingerprint = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.public_key = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.fingerprint.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.public_key.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() - } + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.fingerprint.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.public_key.as_ref() { + os.write_bytes(2, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } - fn new() -> AuthorityKeys_Key { - AuthorityKeys_Key::new() - } + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } - fn default_instance() -> &'static AuthorityKeys_Key { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(AuthorityKeys_Key::new) - } -} + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } -impl ::protobuf::Clear for AuthorityKeys_Key { - fn clear(&mut self) { - self.fingerprint.clear(); - self.public_key.clear(); - self.unknown_fields.clear(); - } -} + fn new() -> Key { + Key::new() + } -impl ::protobuf::reflect::ProtobufValue for AuthorityKeys_Key { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) + fn clear(&mut self) { + self.fingerprint = ::std::option::Option::None; + self.public_key = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static Key { + static instance: Key = Key { + fingerprint: ::std::option::Option::None, + public_key: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } } } diff --git a/src/cast/cast_channel.rs b/src/cast/cast_channel.rs index 45f364c85..e2021f181 100644 --- a/src/cast/cast_channel.rs +++ b/src/cast/cast_channel.rs @@ -1,4 +1,5 @@ -// This file is generated by rust-protobuf 2.27.1. Do not edit +// This file is generated by rust-protobuf 3.2.0. Do not edit +// .proto file is parsed by protoc 3.21.12 // @generated // https://github.com/rust-lang/rust-clippy/issues/702 @@ -15,29 +16,41 @@ #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(trivial_casts)] -#![allow(unused_imports)] #![allow(unused_results)] +#![allow(unused_mut)] + //! Generated file from `cast_channel.proto` +// Generated for lite runtime /// Generated files are compatible only with the same version /// of protobuf runtime. -// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_27_1; +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_2_0; #[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:cast.channel.CastMessage) pub struct CastMessage { // message fields - protocol_version: ::std::option::Option, - source_id: ::protobuf::SingularField<::std::string::String>, - destination_id: ::protobuf::SingularField<::std::string::String>, - namespace: ::protobuf::SingularField<::std::string::String>, - payload_type: ::std::option::Option, - payload_utf8: ::protobuf::SingularField<::std::string::String>, - payload_binary: ::protobuf::SingularField<::std::vec::Vec>, - continued: ::std::option::Option, - remaining_length: ::std::option::Option, + // @@protoc_insertion_point(field:cast.channel.CastMessage.protocol_version) + pub protocol_version: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:cast.channel.CastMessage.source_id) + pub source_id: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:cast.channel.CastMessage.destination_id) + pub destination_id: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:cast.channel.CastMessage.namespace) + pub namespace: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:cast.channel.CastMessage.payload_type) + pub payload_type: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:cast.channel.CastMessage.payload_utf8) + pub payload_utf8: ::std::option::Option<::std::string::String>, + // @@protoc_insertion_point(field:cast.channel.CastMessage.payload_binary) + pub payload_binary: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:cast.channel.CastMessage.continued) + pub continued: ::std::option::Option, + // @@protoc_insertion_point(field:cast.channel.CastMessage.remaining_length) + pub remaining_length: ::std::option::Option, // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, + // @@protoc_insertion_point(special_field:cast.channel.CastMessage.special_fields) + pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a CastMessage { @@ -53,10 +66,13 @@ impl CastMessage { // required .cast.channel.CastMessage.ProtocolVersion protocol_version = 1; - - pub fn get_protocol_version(&self) -> CastMessage_ProtocolVersion { - self.protocol_version.unwrap_or(CastMessage_ProtocolVersion::CASTV2_1_0) + pub fn protocol_version(&self) -> cast_message::ProtocolVersion { + match self.protocol_version { + Some(e) => e.enum_value_or(cast_message::ProtocolVersion::CASTV2_1_0), + None => cast_message::ProtocolVersion::CASTV2_1_0, + } } + pub fn clear_protocol_version(&mut self) { self.protocol_version = ::std::option::Option::None; } @@ -66,21 +82,21 @@ impl CastMessage { } // Param is passed by value, moved - pub fn set_protocol_version(&mut self, v: CastMessage_ProtocolVersion) { - self.protocol_version = ::std::option::Option::Some(v); + pub fn set_protocol_version(&mut self, v: cast_message::ProtocolVersion) { + self.protocol_version = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); } // required string source_id = 2; - - pub fn get_source_id(&self) -> &str { + pub fn source_id(&self) -> &str { match self.source_id.as_ref() { - Some(v) => &v, + Some(v) => v, None => "", } } + pub fn clear_source_id(&mut self) { - self.source_id.clear(); + self.source_id = ::std::option::Option::None; } pub fn has_source_id(&self) -> bool { @@ -89,14 +105,14 @@ impl CastMessage { // Param is passed by value, moved pub fn set_source_id(&mut self, v: ::std::string::String) { - self.source_id = ::protobuf::SingularField::some(v); + self.source_id = ::std::option::Option::Some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_source_id(&mut self) -> &mut ::std::string::String { if self.source_id.is_none() { - self.source_id.set_default(); + self.source_id = ::std::option::Option::Some(::std::string::String::new()); } self.source_id.as_mut().unwrap() } @@ -108,15 +124,15 @@ impl CastMessage { // required string destination_id = 3; - - pub fn get_destination_id(&self) -> &str { + pub fn destination_id(&self) -> &str { match self.destination_id.as_ref() { - Some(v) => &v, + Some(v) => v, None => "", } } + pub fn clear_destination_id(&mut self) { - self.destination_id.clear(); + self.destination_id = ::std::option::Option::None; } pub fn has_destination_id(&self) -> bool { @@ -125,14 +141,14 @@ impl CastMessage { // Param is passed by value, moved pub fn set_destination_id(&mut self, v: ::std::string::String) { - self.destination_id = ::protobuf::SingularField::some(v); + self.destination_id = ::std::option::Option::Some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_destination_id(&mut self) -> &mut ::std::string::String { if self.destination_id.is_none() { - self.destination_id.set_default(); + self.destination_id = ::std::option::Option::Some(::std::string::String::new()); } self.destination_id.as_mut().unwrap() } @@ -144,15 +160,15 @@ impl CastMessage { // required string namespace = 4; - - pub fn get_namespace(&self) -> &str { + pub fn namespace(&self) -> &str { match self.namespace.as_ref() { - Some(v) => &v, + Some(v) => v, None => "", } } + pub fn clear_namespace(&mut self) { - self.namespace.clear(); + self.namespace = ::std::option::Option::None; } pub fn has_namespace(&self) -> bool { @@ -161,14 +177,14 @@ impl CastMessage { // Param is passed by value, moved pub fn set_namespace(&mut self, v: ::std::string::String) { - self.namespace = ::protobuf::SingularField::some(v); + self.namespace = ::std::option::Option::Some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_namespace(&mut self) -> &mut ::std::string::String { if self.namespace.is_none() { - self.namespace.set_default(); + self.namespace = ::std::option::Option::Some(::std::string::String::new()); } self.namespace.as_mut().unwrap() } @@ -180,10 +196,13 @@ impl CastMessage { // required .cast.channel.CastMessage.PayloadType payload_type = 5; - - pub fn get_payload_type(&self) -> CastMessage_PayloadType { - self.payload_type.unwrap_or(CastMessage_PayloadType::STRING) + pub fn payload_type(&self) -> cast_message::PayloadType { + match self.payload_type { + Some(e) => e.enum_value_or(cast_message::PayloadType::STRING), + None => cast_message::PayloadType::STRING, + } } + pub fn clear_payload_type(&mut self) { self.payload_type = ::std::option::Option::None; } @@ -193,21 +212,21 @@ impl CastMessage { } // Param is passed by value, moved - pub fn set_payload_type(&mut self, v: CastMessage_PayloadType) { - self.payload_type = ::std::option::Option::Some(v); + pub fn set_payload_type(&mut self, v: cast_message::PayloadType) { + self.payload_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); } // optional string payload_utf8 = 6; - - pub fn get_payload_utf8(&self) -> &str { + pub fn payload_utf8(&self) -> &str { match self.payload_utf8.as_ref() { - Some(v) => &v, + Some(v) => v, None => "", } } + pub fn clear_payload_utf8(&mut self) { - self.payload_utf8.clear(); + self.payload_utf8 = ::std::option::Option::None; } pub fn has_payload_utf8(&self) -> bool { @@ -216,14 +235,14 @@ impl CastMessage { // Param is passed by value, moved pub fn set_payload_utf8(&mut self, v: ::std::string::String) { - self.payload_utf8 = ::protobuf::SingularField::some(v); + self.payload_utf8 = ::std::option::Option::Some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_payload_utf8(&mut self) -> &mut ::std::string::String { if self.payload_utf8.is_none() { - self.payload_utf8.set_default(); + self.payload_utf8 = ::std::option::Option::Some(::std::string::String::new()); } self.payload_utf8.as_mut().unwrap() } @@ -235,15 +254,15 @@ impl CastMessage { // optional bytes payload_binary = 7; - - pub fn get_payload_binary(&self) -> &[u8] { + pub fn payload_binary(&self) -> &[u8] { match self.payload_binary.as_ref() { - Some(v) => &v, + Some(v) => v, None => &[], } } + pub fn clear_payload_binary(&mut self) { - self.payload_binary.clear(); + self.payload_binary = ::std::option::Option::None; } pub fn has_payload_binary(&self) -> bool { @@ -252,14 +271,14 @@ impl CastMessage { // Param is passed by value, moved pub fn set_payload_binary(&mut self, v: ::std::vec::Vec) { - self.payload_binary = ::protobuf::SingularField::some(v); + self.payload_binary = ::std::option::Option::Some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_payload_binary(&mut self) -> &mut ::std::vec::Vec { if self.payload_binary.is_none() { - self.payload_binary.set_default(); + self.payload_binary = ::std::option::Option::Some(::std::vec::Vec::new()); } self.payload_binary.as_mut().unwrap() } @@ -271,10 +290,10 @@ impl CastMessage { // optional bool continued = 8; - - pub fn get_continued(&self) -> bool { + pub fn continued(&self) -> bool { self.continued.unwrap_or(false) } + pub fn clear_continued(&mut self) { self.continued = ::std::option::Option::None; } @@ -290,10 +309,10 @@ impl CastMessage { // optional uint32 remaining_length = 9; - - pub fn get_remaining_length(&self) -> u32 { + pub fn remaining_length(&self) -> u32 { self.remaining_length.unwrap_or(0) } + pub fn clear_remaining_length(&mut self) { self.remaining_length = ::std::option::Option::None; } @@ -309,6 +328,8 @@ impl CastMessage { } impl ::protobuf::Message for CastMessage { + const NAME: &'static str = "CastMessage"; + fn is_initialized(&self) -> bool { if self.protocol_version.is_none() { return false; @@ -328,47 +349,38 @@ impl ::protobuf::Message for CastMessage { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.protocol_version, 1, &mut self.unknown_fields)? + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.protocol_version = ::std::option::Option::Some(is.read_enum_or_unknown()?); }, - 2 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.source_id)?; + 18 => { + self.source_id = ::std::option::Option::Some(is.read_string()?); }, - 3 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.destination_id)?; + 26 => { + self.destination_id = ::std::option::Option::Some(is.read_string()?); }, - 4 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.namespace)?; + 34 => { + self.namespace = ::std::option::Option::Some(is.read_string()?); }, - 5 => { - ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.payload_type, 5, &mut self.unknown_fields)? + 40 => { + self.payload_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); }, - 6 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.payload_utf8)?; + 50 => { + self.payload_utf8 = ::std::option::Option::Some(is.read_string()?); }, - 7 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.payload_binary)?; + 58 => { + self.payload_binary = ::std::option::Option::Some(is.read_bytes()?); }, - 8 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_bool()?; - self.continued = ::std::option::Option::Some(tmp); + 64 => { + self.continued = ::std::option::Option::Some(is.read_bool()?); }, - 9 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_uint32()?; - self.remaining_length = ::std::option::Option::Some(tmp); + 72 => { + self.remaining_length = ::std::option::Option::Some(is.read_uint32()?); }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } @@ -377,61 +389,61 @@ impl ::protobuf::Message for CastMessage { // Compute sizes of nested messages #[allow(unused_variables)] - fn compute_size(&self) -> u32 { + fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.protocol_version { - my_size += ::protobuf::rt::enum_size(1, v); + my_size += ::protobuf::rt::int32_size(1, v.value()); } - if let Some(ref v) = self.source_id.as_ref() { + if let Some(v) = self.source_id.as_ref() { my_size += ::protobuf::rt::string_size(2, &v); } - if let Some(ref v) = self.destination_id.as_ref() { + if let Some(v) = self.destination_id.as_ref() { my_size += ::protobuf::rt::string_size(3, &v); } - if let Some(ref v) = self.namespace.as_ref() { + if let Some(v) = self.namespace.as_ref() { my_size += ::protobuf::rt::string_size(4, &v); } if let Some(v) = self.payload_type { - my_size += ::protobuf::rt::enum_size(5, v); + my_size += ::protobuf::rt::int32_size(5, v.value()); } - if let Some(ref v) = self.payload_utf8.as_ref() { + if let Some(v) = self.payload_utf8.as_ref() { my_size += ::protobuf::rt::string_size(6, &v); } - if let Some(ref v) = self.payload_binary.as_ref() { + if let Some(v) = self.payload_binary.as_ref() { my_size += ::protobuf::rt::bytes_size(7, &v); } if let Some(v) = self.continued { - my_size += 2; + my_size += 1 + 1; } if let Some(v) = self.remaining_length { - my_size += ::protobuf::rt::value_size(9, v, ::protobuf::wire_format::WireTypeVarint); + my_size += ::protobuf::rt::uint32_size(9, v); } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.protocol_version { - os.write_enum(1, ::protobuf::ProtobufEnum::value(&v))?; + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; } - if let Some(ref v) = self.source_id.as_ref() { - os.write_string(2, &v)?; + if let Some(v) = self.source_id.as_ref() { + os.write_string(2, v)?; } - if let Some(ref v) = self.destination_id.as_ref() { - os.write_string(3, &v)?; + if let Some(v) = self.destination_id.as_ref() { + os.write_string(3, v)?; } - if let Some(ref v) = self.namespace.as_ref() { - os.write_string(4, &v)?; + if let Some(v) = self.namespace.as_ref() { + os.write_string(4, v)?; } if let Some(v) = self.payload_type { - os.write_enum(5, ::protobuf::ProtobufEnum::value(&v))?; + os.write_enum(5, ::protobuf::EnumOrUnknown::value(&v))?; } - if let Some(ref v) = self.payload_utf8.as_ref() { - os.write_string(6, &v)?; + if let Some(v) = self.payload_utf8.as_ref() { + os.write_string(6, v)?; } - if let Some(ref v) = self.payload_binary.as_ref() { - os.write_bytes(7, &v)?; + if let Some(v) = self.payload_binary.as_ref() { + os.write_bytes(7, v)?; } if let Some(v) = self.continued { os.write_bool(8, v)?; @@ -439,168 +451,150 @@ impl ::protobuf::Message for CastMessage { if let Some(v) = self.remaining_length { os.write_uint32(9, v)?; } - os.write_unknown_fields(self.get_unknown_fields())?; + os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields } - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields } fn new() -> CastMessage { CastMessage::new() } - fn default_instance() -> &'static CastMessage { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(CastMessage::new) - } -} - -impl ::protobuf::Clear for CastMessage { fn clear(&mut self) { self.protocol_version = ::std::option::Option::None; - self.source_id.clear(); - self.destination_id.clear(); - self.namespace.clear(); + self.source_id = ::std::option::Option::None; + self.destination_id = ::std::option::Option::None; + self.namespace = ::std::option::Option::None; self.payload_type = ::std::option::Option::None; - self.payload_utf8.clear(); - self.payload_binary.clear(); + self.payload_utf8 = ::std::option::Option::None; + self.payload_binary = ::std::option::Option::None; self.continued = ::std::option::Option::None; self.remaining_length = ::std::option::Option::None; - self.unknown_fields.clear(); + self.special_fields.clear(); } -} -impl ::protobuf::reflect::ProtobufValue for CastMessage { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) + fn default_instance() -> &'static CastMessage { + static instance: CastMessage = CastMessage { + protocol_version: ::std::option::Option::None, + source_id: ::std::option::Option::None, + destination_id: ::std::option::Option::None, + namespace: ::std::option::Option::None, + payload_type: ::std::option::Option::None, + payload_utf8: ::std::option::Option::None, + payload_binary: ::std::option::Option::None, + continued: ::std::option::Option::None, + remaining_length: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance } } -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum CastMessage_ProtocolVersion { - CASTV2_1_0 = 0, - CASTV2_1_1 = 1, - CASTV2_1_2 = 2, - CASTV2_1_3 = 3, -} - -impl ::protobuf::ProtobufEnum for CastMessage_ProtocolVersion { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CastMessage_ProtocolVersion::CASTV2_1_0), - 1 => ::std::option::Option::Some(CastMessage_ProtocolVersion::CASTV2_1_1), - 2 => ::std::option::Option::Some(CastMessage_ProtocolVersion::CASTV2_1_2), - 3 => ::std::option::Option::Some(CastMessage_ProtocolVersion::CASTV2_1_3), - _ => ::std::option::Option::None +/// Nested message and enums of message `CastMessage` +pub mod cast_message { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:cast.channel.CastMessage.ProtocolVersion) + pub enum ProtocolVersion { + // @@protoc_insertion_point(enum_value:cast.channel.CastMessage.ProtocolVersion.CASTV2_1_0) + CASTV2_1_0 = 0, + // @@protoc_insertion_point(enum_value:cast.channel.CastMessage.ProtocolVersion.CASTV2_1_1) + CASTV2_1_1 = 1, + // @@protoc_insertion_point(enum_value:cast.channel.CastMessage.ProtocolVersion.CASTV2_1_2) + CASTV2_1_2 = 2, + // @@protoc_insertion_point(enum_value:cast.channel.CastMessage.ProtocolVersion.CASTV2_1_3) + CASTV2_1_3 = 3, + } + + impl ::protobuf::Enum for ProtocolVersion { + const NAME: &'static str = "ProtocolVersion"; + + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(ProtocolVersion::CASTV2_1_0), + 1 => ::std::option::Option::Some(ProtocolVersion::CASTV2_1_1), + 2 => ::std::option::Option::Some(ProtocolVersion::CASTV2_1_2), + 3 => ::std::option::Option::Some(ProtocolVersion::CASTV2_1_3), + _ => ::std::option::Option::None + } } - } - fn values() -> &'static [Self] { - static values: &'static [CastMessage_ProtocolVersion] = &[ - CastMessage_ProtocolVersion::CASTV2_1_0, - CastMessage_ProtocolVersion::CASTV2_1_1, - CastMessage_ProtocolVersion::CASTV2_1_2, - CastMessage_ProtocolVersion::CASTV2_1_3, + const VALUES: &'static [ProtocolVersion] = &[ + ProtocolVersion::CASTV2_1_0, + ProtocolVersion::CASTV2_1_1, + ProtocolVersion::CASTV2_1_2, + ProtocolVersion::CASTV2_1_3, ]; - values } -} -impl ::std::marker::Copy for CastMessage_ProtocolVersion { -} - -impl ::std::default::Default for CastMessage_ProtocolVersion { - fn default() -> Self { - CastMessage_ProtocolVersion::CASTV2_1_0 + impl ::std::default::Default for ProtocolVersion { + fn default() -> Self { + ProtocolVersion::CASTV2_1_0 + } } -} -impl ::protobuf::reflect::ProtobufValue for CastMessage_ProtocolVersion { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) + + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:cast.channel.CastMessage.PayloadType) + pub enum PayloadType { + // @@protoc_insertion_point(enum_value:cast.channel.CastMessage.PayloadType.STRING) + STRING = 0, + // @@protoc_insertion_point(enum_value:cast.channel.CastMessage.PayloadType.BINARY) + BINARY = 1, } -} -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum CastMessage_PayloadType { - STRING = 0, - BINARY = 1, -} + impl ::protobuf::Enum for PayloadType { + const NAME: &'static str = "PayloadType"; -impl ::protobuf::ProtobufEnum for CastMessage_PayloadType { - fn value(&self) -> i32 { - *self as i32 - } + fn value(&self) -> i32 { + *self as i32 + } - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(CastMessage_PayloadType::STRING), - 1 => ::std::option::Option::Some(CastMessage_PayloadType::BINARY), - _ => ::std::option::Option::None + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(PayloadType::STRING), + 1 => ::std::option::Option::Some(PayloadType::BINARY), + _ => ::std::option::Option::None + } } - } - fn values() -> &'static [Self] { - static values: &'static [CastMessage_PayloadType] = &[ - CastMessage_PayloadType::STRING, - CastMessage_PayloadType::BINARY, + const VALUES: &'static [PayloadType] = &[ + PayloadType::STRING, + PayloadType::BINARY, ]; - values } -} -impl ::std::marker::Copy for CastMessage_PayloadType { -} - -impl ::std::default::Default for CastMessage_PayloadType { - fn default() -> Self { - CastMessage_PayloadType::STRING + impl ::std::default::Default for PayloadType { + fn default() -> Self { + PayloadType::STRING + } } -} -impl ::protobuf::reflect::ProtobufValue for CastMessage_PayloadType { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) - } } #[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:cast.channel.AuthChallenge) pub struct AuthChallenge { // message fields - signature_algorithm: ::std::option::Option, - sender_nonce: ::protobuf::SingularField<::std::vec::Vec>, - hash_algorithm: ::std::option::Option, + // @@protoc_insertion_point(field:cast.channel.AuthChallenge.signature_algorithm) + pub signature_algorithm: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:cast.channel.AuthChallenge.sender_nonce) + pub sender_nonce: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:cast.channel.AuthChallenge.hash_algorithm) + pub hash_algorithm: ::std::option::Option<::protobuf::EnumOrUnknown>, // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, + // @@protoc_insertion_point(special_field:cast.channel.AuthChallenge.special_fields) + pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AuthChallenge { @@ -616,10 +610,13 @@ impl AuthChallenge { // optional .cast.channel.SignatureAlgorithm signature_algorithm = 1; - - pub fn get_signature_algorithm(&self) -> SignatureAlgorithm { - self.signature_algorithm.unwrap_or(SignatureAlgorithm::RSASSA_PKCS1v15) + pub fn signature_algorithm(&self) -> SignatureAlgorithm { + match self.signature_algorithm { + Some(e) => e.enum_value_or(SignatureAlgorithm::RSASSA_PKCS1v15), + None => SignatureAlgorithm::RSASSA_PKCS1v15, + } } + pub fn clear_signature_algorithm(&mut self) { self.signature_algorithm = ::std::option::Option::None; } @@ -630,20 +627,20 @@ impl AuthChallenge { // Param is passed by value, moved pub fn set_signature_algorithm(&mut self, v: SignatureAlgorithm) { - self.signature_algorithm = ::std::option::Option::Some(v); + self.signature_algorithm = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); } // optional bytes sender_nonce = 2; - - pub fn get_sender_nonce(&self) -> &[u8] { + pub fn sender_nonce(&self) -> &[u8] { match self.sender_nonce.as_ref() { - Some(v) => &v, + Some(v) => v, None => &[], } } + pub fn clear_sender_nonce(&mut self) { - self.sender_nonce.clear(); + self.sender_nonce = ::std::option::Option::None; } pub fn has_sender_nonce(&self) -> bool { @@ -652,14 +649,14 @@ impl AuthChallenge { // Param is passed by value, moved pub fn set_sender_nonce(&mut self, v: ::std::vec::Vec) { - self.sender_nonce = ::protobuf::SingularField::some(v); + self.sender_nonce = ::std::option::Option::Some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_sender_nonce(&mut self) -> &mut ::std::vec::Vec { if self.sender_nonce.is_none() { - self.sender_nonce.set_default(); + self.sender_nonce = ::std::option::Option::Some(::std::vec::Vec::new()); } self.sender_nonce.as_mut().unwrap() } @@ -671,10 +668,13 @@ impl AuthChallenge { // optional .cast.channel.HashAlgorithm hash_algorithm = 3; - - pub fn get_hash_algorithm(&self) -> HashAlgorithm { - self.hash_algorithm.unwrap_or(HashAlgorithm::SHA1) + pub fn hash_algorithm(&self) -> HashAlgorithm { + match self.hash_algorithm { + Some(e) => e.enum_value_or(HashAlgorithm::SHA1), + None => HashAlgorithm::SHA1, + } } + pub fn clear_hash_algorithm(&mut self) { self.hash_algorithm = ::std::option::Option::None; } @@ -685,30 +685,31 @@ impl AuthChallenge { // Param is passed by value, moved pub fn set_hash_algorithm(&mut self, v: HashAlgorithm) { - self.hash_algorithm = ::std::option::Option::Some(v); + self.hash_algorithm = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); } } impl ::protobuf::Message for AuthChallenge { + const NAME: &'static str = "AuthChallenge"; + fn is_initialized(&self) -> bool { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.signature_algorithm, 1, &mut self.unknown_fields)? + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.signature_algorithm = ::std::option::Option::Some(is.read_enum_or_unknown()?); }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.sender_nonce)?; + 18 => { + self.sender_nonce = ::std::option::Option::Some(is.read_bytes()?); }, - 3 => { - ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.hash_algorithm, 3, &mut self.unknown_fields)? + 24 => { + self.hash_algorithm = ::std::option::Option::Some(is.read_enum_or_unknown()?); }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } @@ -717,100 +718,87 @@ impl ::protobuf::Message for AuthChallenge { // Compute sizes of nested messages #[allow(unused_variables)] - fn compute_size(&self) -> u32 { + fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.signature_algorithm { - my_size += ::protobuf::rt::enum_size(1, v); + my_size += ::protobuf::rt::int32_size(1, v.value()); } - if let Some(ref v) = self.sender_nonce.as_ref() { + if let Some(v) = self.sender_nonce.as_ref() { my_size += ::protobuf::rt::bytes_size(2, &v); } if let Some(v) = self.hash_algorithm { - my_size += ::protobuf::rt::enum_size(3, v); + my_size += ::protobuf::rt::int32_size(3, v.value()); } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.signature_algorithm { - os.write_enum(1, ::protobuf::ProtobufEnum::value(&v))?; + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; } - if let Some(ref v) = self.sender_nonce.as_ref() { - os.write_bytes(2, &v)?; + if let Some(v) = self.sender_nonce.as_ref() { + os.write_bytes(2, v)?; } if let Some(v) = self.hash_algorithm { - os.write_enum(3, ::protobuf::ProtobufEnum::value(&v))?; + os.write_enum(3, ::protobuf::EnumOrUnknown::value(&v))?; } - os.write_unknown_fields(self.get_unknown_fields())?; + os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields } - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields } fn new() -> AuthChallenge { AuthChallenge::new() } - fn default_instance() -> &'static AuthChallenge { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(AuthChallenge::new) - } -} - -impl ::protobuf::Clear for AuthChallenge { fn clear(&mut self) { self.signature_algorithm = ::std::option::Option::None; - self.sender_nonce.clear(); + self.sender_nonce = ::std::option::Option::None; self.hash_algorithm = ::std::option::Option::None; - self.unknown_fields.clear(); + self.special_fields.clear(); } -} -impl ::protobuf::reflect::ProtobufValue for AuthChallenge { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) + fn default_instance() -> &'static AuthChallenge { + static instance: AuthChallenge = AuthChallenge { + signature_algorithm: ::std::option::Option::None, + sender_nonce: ::std::option::Option::None, + hash_algorithm: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance } } #[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:cast.channel.AuthResponse) pub struct AuthResponse { // message fields - signature: ::protobuf::SingularField<::std::vec::Vec>, - client_auth_certificate: ::protobuf::SingularField<::std::vec::Vec>, - pub intermediate_certificate: ::protobuf::RepeatedField<::std::vec::Vec>, - signature_algorithm: ::std::option::Option, - sender_nonce: ::protobuf::SingularField<::std::vec::Vec>, - hash_algorithm: ::std::option::Option, - crl: ::protobuf::SingularField<::std::vec::Vec>, + // @@protoc_insertion_point(field:cast.channel.AuthResponse.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:cast.channel.AuthResponse.client_auth_certificate) + pub client_auth_certificate: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:cast.channel.AuthResponse.intermediate_certificate) + pub intermediate_certificate: ::std::vec::Vec<::std::vec::Vec>, + // @@protoc_insertion_point(field:cast.channel.AuthResponse.signature_algorithm) + pub signature_algorithm: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:cast.channel.AuthResponse.sender_nonce) + pub sender_nonce: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:cast.channel.AuthResponse.hash_algorithm) + pub hash_algorithm: ::std::option::Option<::protobuf::EnumOrUnknown>, + // @@protoc_insertion_point(field:cast.channel.AuthResponse.crl) + pub crl: ::std::option::Option<::std::vec::Vec>, // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, + // @@protoc_insertion_point(special_field:cast.channel.AuthResponse.special_fields) + pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AuthResponse { @@ -826,15 +814,15 @@ impl AuthResponse { // required bytes signature = 1; - - pub fn get_signature(&self) -> &[u8] { + pub fn signature(&self) -> &[u8] { match self.signature.as_ref() { - Some(v) => &v, + Some(v) => v, None => &[], } } + pub fn clear_signature(&mut self) { - self.signature.clear(); + self.signature = ::std::option::Option::None; } pub fn has_signature(&self) -> bool { @@ -843,14 +831,14 @@ impl AuthResponse { // Param is passed by value, moved pub fn set_signature(&mut self, v: ::std::vec::Vec) { - self.signature = ::protobuf::SingularField::some(v); + self.signature = ::std::option::Option::Some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { if self.signature.is_none() { - self.signature.set_default(); + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); } self.signature.as_mut().unwrap() } @@ -862,15 +850,15 @@ impl AuthResponse { // required bytes client_auth_certificate = 2; - - pub fn get_client_auth_certificate(&self) -> &[u8] { + pub fn client_auth_certificate(&self) -> &[u8] { match self.client_auth_certificate.as_ref() { - Some(v) => &v, + Some(v) => v, None => &[], } } + pub fn clear_client_auth_certificate(&mut self) { - self.client_auth_certificate.clear(); + self.client_auth_certificate = ::std::option::Option::None; } pub fn has_client_auth_certificate(&self) -> bool { @@ -879,14 +867,14 @@ impl AuthResponse { // Param is passed by value, moved pub fn set_client_auth_certificate(&mut self, v: ::std::vec::Vec) { - self.client_auth_certificate = ::protobuf::SingularField::some(v); + self.client_auth_certificate = ::std::option::Option::Some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_client_auth_certificate(&mut self) -> &mut ::std::vec::Vec { if self.client_auth_certificate.is_none() { - self.client_auth_certificate.set_default(); + self.client_auth_certificate = ::std::option::Option::Some(::std::vec::Vec::new()); } self.client_auth_certificate.as_mut().unwrap() } @@ -896,37 +884,15 @@ impl AuthResponse { self.client_auth_certificate.take().unwrap_or_else(|| ::std::vec::Vec::new()) } - // repeated bytes intermediate_certificate = 3; - - - pub fn get_intermediate_certificate(&self) -> &[::std::vec::Vec] { - &self.intermediate_certificate - } - pub fn clear_intermediate_certificate(&mut self) { - self.intermediate_certificate.clear(); - } - - // Param is passed by value, moved - pub fn set_intermediate_certificate(&mut self, v: ::protobuf::RepeatedField<::std::vec::Vec>) { - self.intermediate_certificate = v; - } - - // Mutable pointer to the field. - pub fn mut_intermediate_certificate(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { - &mut self.intermediate_certificate - } - - // Take field - pub fn take_intermediate_certificate(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec> { - ::std::mem::replace(&mut self.intermediate_certificate, ::protobuf::RepeatedField::new()) - } - // optional .cast.channel.SignatureAlgorithm signature_algorithm = 4; - - pub fn get_signature_algorithm(&self) -> SignatureAlgorithm { - self.signature_algorithm.unwrap_or(SignatureAlgorithm::RSASSA_PKCS1v15) + pub fn signature_algorithm(&self) -> SignatureAlgorithm { + match self.signature_algorithm { + Some(e) => e.enum_value_or(SignatureAlgorithm::RSASSA_PKCS1v15), + None => SignatureAlgorithm::RSASSA_PKCS1v15, + } } + pub fn clear_signature_algorithm(&mut self) { self.signature_algorithm = ::std::option::Option::None; } @@ -937,20 +903,20 @@ impl AuthResponse { // Param is passed by value, moved pub fn set_signature_algorithm(&mut self, v: SignatureAlgorithm) { - self.signature_algorithm = ::std::option::Option::Some(v); + self.signature_algorithm = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); } // optional bytes sender_nonce = 5; - - pub fn get_sender_nonce(&self) -> &[u8] { + pub fn sender_nonce(&self) -> &[u8] { match self.sender_nonce.as_ref() { - Some(v) => &v, + Some(v) => v, None => &[], } } + pub fn clear_sender_nonce(&mut self) { - self.sender_nonce.clear(); + self.sender_nonce = ::std::option::Option::None; } pub fn has_sender_nonce(&self) -> bool { @@ -959,14 +925,14 @@ impl AuthResponse { // Param is passed by value, moved pub fn set_sender_nonce(&mut self, v: ::std::vec::Vec) { - self.sender_nonce = ::protobuf::SingularField::some(v); + self.sender_nonce = ::std::option::Option::Some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_sender_nonce(&mut self) -> &mut ::std::vec::Vec { if self.sender_nonce.is_none() { - self.sender_nonce.set_default(); + self.sender_nonce = ::std::option::Option::Some(::std::vec::Vec::new()); } self.sender_nonce.as_mut().unwrap() } @@ -978,10 +944,13 @@ impl AuthResponse { // optional .cast.channel.HashAlgorithm hash_algorithm = 6; - - pub fn get_hash_algorithm(&self) -> HashAlgorithm { - self.hash_algorithm.unwrap_or(HashAlgorithm::SHA1) + pub fn hash_algorithm(&self) -> HashAlgorithm { + match self.hash_algorithm { + Some(e) => e.enum_value_or(HashAlgorithm::SHA1), + None => HashAlgorithm::SHA1, + } } + pub fn clear_hash_algorithm(&mut self) { self.hash_algorithm = ::std::option::Option::None; } @@ -992,20 +961,20 @@ impl AuthResponse { // Param is passed by value, moved pub fn set_hash_algorithm(&mut self, v: HashAlgorithm) { - self.hash_algorithm = ::std::option::Option::Some(v); + self.hash_algorithm = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); } // optional bytes crl = 7; - - pub fn get_crl(&self) -> &[u8] { + pub fn crl(&self) -> &[u8] { match self.crl.as_ref() { - Some(v) => &v, + Some(v) => v, None => &[], } } + pub fn clear_crl(&mut self) { - self.crl.clear(); + self.crl = ::std::option::Option::None; } pub fn has_crl(&self) -> bool { @@ -1014,14 +983,14 @@ impl AuthResponse { // Param is passed by value, moved pub fn set_crl(&mut self, v: ::std::vec::Vec) { - self.crl = ::protobuf::SingularField::some(v); + self.crl = ::std::option::Option::Some(v); } // Mutable pointer to the field. // If field is not initialized, it is initialized with default value first. pub fn mut_crl(&mut self) -> &mut ::std::vec::Vec { if self.crl.is_none() { - self.crl.set_default(); + self.crl = ::std::option::Option::Some(::std::vec::Vec::new()); } self.crl.as_mut().unwrap() } @@ -1033,6 +1002,8 @@ impl AuthResponse { } impl ::protobuf::Message for AuthResponse { + const NAME: &'static str = "AuthResponse"; + fn is_initialized(&self) -> bool { if self.signature.is_none() { return false; @@ -1043,33 +1014,32 @@ impl ::protobuf::Message for AuthResponse { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.signature)?; + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); }, - 2 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.client_auth_certificate)?; + 18 => { + self.client_auth_certificate = ::std::option::Option::Some(is.read_bytes()?); }, - 3 => { - ::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.intermediate_certificate)?; + 26 => { + self.intermediate_certificate.push(is.read_bytes()?); }, - 4 => { - ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.signature_algorithm, 4, &mut self.unknown_fields)? + 32 => { + self.signature_algorithm = ::std::option::Option::Some(is.read_enum_or_unknown()?); }, - 5 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.sender_nonce)?; + 42 => { + self.sender_nonce = ::std::option::Option::Some(is.read_bytes()?); }, - 6 => { - ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.hash_algorithm, 6, &mut self.unknown_fields)? + 48 => { + self.hash_algorithm = ::std::option::Option::Some(is.read_enum_or_unknown()?); }, - 7 => { - ::protobuf::rt::read_singular_bytes_into(wire_type, is, &mut self.crl)?; + 58 => { + self.crl = ::std::option::Option::Some(is.read_bytes()?); }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } @@ -1078,122 +1048,107 @@ impl ::protobuf::Message for AuthResponse { // Compute sizes of nested messages #[allow(unused_variables)] - fn compute_size(&self) -> u32 { + fn compute_size(&self) -> u64 { let mut my_size = 0; - if let Some(ref v) = self.signature.as_ref() { + if let Some(v) = self.signature.as_ref() { my_size += ::protobuf::rt::bytes_size(1, &v); } - if let Some(ref v) = self.client_auth_certificate.as_ref() { + if let Some(v) = self.client_auth_certificate.as_ref() { my_size += ::protobuf::rt::bytes_size(2, &v); } for value in &self.intermediate_certificate { my_size += ::protobuf::rt::bytes_size(3, &value); }; if let Some(v) = self.signature_algorithm { - my_size += ::protobuf::rt::enum_size(4, v); + my_size += ::protobuf::rt::int32_size(4, v.value()); } - if let Some(ref v) = self.sender_nonce.as_ref() { + if let Some(v) = self.sender_nonce.as_ref() { my_size += ::protobuf::rt::bytes_size(5, &v); } if let Some(v) = self.hash_algorithm { - my_size += ::protobuf::rt::enum_size(6, v); + my_size += ::protobuf::rt::int32_size(6, v.value()); } - if let Some(ref v) = self.crl.as_ref() { + if let Some(v) = self.crl.as_ref() { my_size += ::protobuf::rt::bytes_size(7, &v); } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.signature.as_ref() { - os.write_bytes(1, &v)?; + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.signature.as_ref() { + os.write_bytes(1, v)?; } - if let Some(ref v) = self.client_auth_certificate.as_ref() { - os.write_bytes(2, &v)?; + if let Some(v) = self.client_auth_certificate.as_ref() { + os.write_bytes(2, v)?; } for v in &self.intermediate_certificate { os.write_bytes(3, &v)?; }; if let Some(v) = self.signature_algorithm { - os.write_enum(4, ::protobuf::ProtobufEnum::value(&v))?; + os.write_enum(4, ::protobuf::EnumOrUnknown::value(&v))?; } - if let Some(ref v) = self.sender_nonce.as_ref() { - os.write_bytes(5, &v)?; + if let Some(v) = self.sender_nonce.as_ref() { + os.write_bytes(5, v)?; } if let Some(v) = self.hash_algorithm { - os.write_enum(6, ::protobuf::ProtobufEnum::value(&v))?; + os.write_enum(6, ::protobuf::EnumOrUnknown::value(&v))?; } - if let Some(ref v) = self.crl.as_ref() { - os.write_bytes(7, &v)?; + if let Some(v) = self.crl.as_ref() { + os.write_bytes(7, v)?; } - os.write_unknown_fields(self.get_unknown_fields())?; + os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields } - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields } fn new() -> AuthResponse { AuthResponse::new() } - fn default_instance() -> &'static AuthResponse { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(AuthResponse::new) - } -} - -impl ::protobuf::Clear for AuthResponse { fn clear(&mut self) { - self.signature.clear(); - self.client_auth_certificate.clear(); + self.signature = ::std::option::Option::None; + self.client_auth_certificate = ::std::option::Option::None; self.intermediate_certificate.clear(); self.signature_algorithm = ::std::option::Option::None; - self.sender_nonce.clear(); + self.sender_nonce = ::std::option::Option::None; self.hash_algorithm = ::std::option::Option::None; - self.crl.clear(); - self.unknown_fields.clear(); + self.crl = ::std::option::Option::None; + self.special_fields.clear(); } -} -impl ::protobuf::reflect::ProtobufValue for AuthResponse { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) + fn default_instance() -> &'static AuthResponse { + static instance: AuthResponse = AuthResponse { + signature: ::std::option::Option::None, + client_auth_certificate: ::std::option::Option::None, + intermediate_certificate: ::std::vec::Vec::new(), + signature_algorithm: ::std::option::Option::None, + sender_nonce: ::std::option::Option::None, + hash_algorithm: ::std::option::Option::None, + crl: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance } } #[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:cast.channel.AuthError) pub struct AuthError { // message fields - error_type: ::std::option::Option, + // @@protoc_insertion_point(field:cast.channel.AuthError.error_type) + pub error_type: ::std::option::Option<::protobuf::EnumOrUnknown>, // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, + // @@protoc_insertion_point(special_field:cast.channel.AuthError.special_fields) + pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a AuthError { @@ -1209,10 +1164,13 @@ impl AuthError { // required .cast.channel.AuthError.ErrorType error_type = 1; - - pub fn get_error_type(&self) -> AuthError_ErrorType { - self.error_type.unwrap_or(AuthError_ErrorType::INTERNAL_ERROR) + pub fn error_type(&self) -> auth_error::ErrorType { + match self.error_type { + Some(e) => e.enum_value_or(auth_error::ErrorType::INTERNAL_ERROR), + None => auth_error::ErrorType::INTERNAL_ERROR, + } } + pub fn clear_error_type(&mut self) { self.error_type = ::std::option::Option::None; } @@ -1222,12 +1180,14 @@ impl AuthError { } // Param is passed by value, moved - pub fn set_error_type(&mut self, v: AuthError_ErrorType) { - self.error_type = ::std::option::Option::Some(v); + pub fn set_error_type(&mut self, v: auth_error::ErrorType) { + self.error_type = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v)); } } impl ::protobuf::Message for AuthError { + const NAME: &'static str = "AuthError"; + fn is_initialized(&self) -> bool { if self.error_type.is_none() { return false; @@ -1235,15 +1195,14 @@ impl ::protobuf::Message for AuthError { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.error_type, 1, &mut self.unknown_fields)? + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 8 => { + self.error_type = ::std::option::Option::Some(is.read_enum_or_unknown()?); }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } @@ -1252,128 +1211,107 @@ impl ::protobuf::Message for AuthError { // Compute sizes of nested messages #[allow(unused_variables)] - fn compute_size(&self) -> u32 { + fn compute_size(&self) -> u64 { let mut my_size = 0; if let Some(v) = self.error_type { - my_size += ::protobuf::rt::enum_size(1, v); + my_size += ::protobuf::rt::int32_size(1, v.value()); } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { if let Some(v) = self.error_type { - os.write_enum(1, ::protobuf::ProtobufEnum::value(&v))?; + os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?; } - os.write_unknown_fields(self.get_unknown_fields())?; + os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } - fn get_cached_size(&self) -> u32 { - self.cached_size.get() - } - - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields } - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields } fn new() -> AuthError { AuthError::new() } - fn default_instance() -> &'static AuthError { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(AuthError::new) - } -} - -impl ::protobuf::Clear for AuthError { fn clear(&mut self) { self.error_type = ::std::option::Option::None; - self.unknown_fields.clear(); + self.special_fields.clear(); } -} -impl ::protobuf::reflect::ProtobufValue for AuthError { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) + fn default_instance() -> &'static AuthError { + static instance: AuthError = AuthError { + error_type: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance } } -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum AuthError_ErrorType { - INTERNAL_ERROR = 0, - NO_TLS = 1, - SIGNATURE_ALGORITHM_UNAVAILABLE = 2, -} - -impl ::protobuf::ProtobufEnum for AuthError_ErrorType { - fn value(&self) -> i32 { - *self as i32 +/// Nested message and enums of message `AuthError` +pub mod auth_error { + #[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] + // @@protoc_insertion_point(enum:cast.channel.AuthError.ErrorType) + pub enum ErrorType { + // @@protoc_insertion_point(enum_value:cast.channel.AuthError.ErrorType.INTERNAL_ERROR) + INTERNAL_ERROR = 0, + // @@protoc_insertion_point(enum_value:cast.channel.AuthError.ErrorType.NO_TLS) + NO_TLS = 1, + // @@protoc_insertion_point(enum_value:cast.channel.AuthError.ErrorType.SIGNATURE_ALGORITHM_UNAVAILABLE) + SIGNATURE_ALGORITHM_UNAVAILABLE = 2, } - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(AuthError_ErrorType::INTERNAL_ERROR), - 1 => ::std::option::Option::Some(AuthError_ErrorType::NO_TLS), - 2 => ::std::option::Option::Some(AuthError_ErrorType::SIGNATURE_ALGORITHM_UNAVAILABLE), - _ => ::std::option::Option::None + impl ::protobuf::Enum for ErrorType { + const NAME: &'static str = "ErrorType"; + + fn value(&self) -> i32 { + *self as i32 } - } - fn values() -> &'static [Self] { - static values: &'static [AuthError_ErrorType] = &[ - AuthError_ErrorType::INTERNAL_ERROR, - AuthError_ErrorType::NO_TLS, - AuthError_ErrorType::SIGNATURE_ALGORITHM_UNAVAILABLE, + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(ErrorType::INTERNAL_ERROR), + 1 => ::std::option::Option::Some(ErrorType::NO_TLS), + 2 => ::std::option::Option::Some(ErrorType::SIGNATURE_ALGORITHM_UNAVAILABLE), + _ => ::std::option::Option::None + } + } + + const VALUES: &'static [ErrorType] = &[ + ErrorType::INTERNAL_ERROR, + ErrorType::NO_TLS, + ErrorType::SIGNATURE_ALGORITHM_UNAVAILABLE, ]; - values } -} - -impl ::std::marker::Copy for AuthError_ErrorType { -} -impl ::std::default::Default for AuthError_ErrorType { - fn default() -> Self { - AuthError_ErrorType::INTERNAL_ERROR + impl ::std::default::Default for ErrorType { + fn default() -> Self { + ErrorType::INTERNAL_ERROR + } } -} -impl ::protobuf::reflect::ProtobufValue for AuthError_ErrorType { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) - } } #[derive(PartialEq,Clone,Default,Debug)] +// @@protoc_insertion_point(message:cast.channel.DeviceAuthMessage) pub struct DeviceAuthMessage { // message fields - pub challenge: ::protobuf::SingularPtrField, - pub response: ::protobuf::SingularPtrField, - pub error: ::protobuf::SingularPtrField, + // @@protoc_insertion_point(field:cast.channel.DeviceAuthMessage.challenge) + pub challenge: ::protobuf::MessageField, + // @@protoc_insertion_point(field:cast.channel.DeviceAuthMessage.response) + pub response: ::protobuf::MessageField, + // @@protoc_insertion_point(field:cast.channel.DeviceAuthMessage.error) + pub error: ::protobuf::MessageField, // special fields - pub unknown_fields: ::protobuf::UnknownFields, - pub cached_size: ::protobuf::CachedSize, + // @@protoc_insertion_point(special_field:cast.channel.DeviceAuthMessage.special_fields) + pub special_fields: ::protobuf::SpecialFields, } impl<'a> ::std::default::Default for &'a DeviceAuthMessage { @@ -1386,108 +1324,11 @@ impl DeviceAuthMessage { pub fn new() -> DeviceAuthMessage { ::std::default::Default::default() } - - // optional .cast.channel.AuthChallenge challenge = 1; - - - pub fn get_challenge(&self) -> &AuthChallenge { - self.challenge.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_challenge(&mut self) { - self.challenge.clear(); - } - - pub fn has_challenge(&self) -> bool { - self.challenge.is_some() - } - - // Param is passed by value, moved - pub fn set_challenge(&mut self, v: AuthChallenge) { - self.challenge = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_challenge(&mut self) -> &mut AuthChallenge { - if self.challenge.is_none() { - self.challenge.set_default(); - } - self.challenge.as_mut().unwrap() - } - - // Take field - pub fn take_challenge(&mut self) -> AuthChallenge { - self.challenge.take().unwrap_or_else(|| AuthChallenge::new()) - } - - // optional .cast.channel.AuthResponse response = 2; - - - pub fn get_response(&self) -> &AuthResponse { - self.response.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_response(&mut self) { - self.response.clear(); - } - - pub fn has_response(&self) -> bool { - self.response.is_some() - } - - // Param is passed by value, moved - pub fn set_response(&mut self, v: AuthResponse) { - self.response = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_response(&mut self) -> &mut AuthResponse { - if self.response.is_none() { - self.response.set_default(); - } - self.response.as_mut().unwrap() - } - - // Take field - pub fn take_response(&mut self) -> AuthResponse { - self.response.take().unwrap_or_else(|| AuthResponse::new()) - } - - // optional .cast.channel.AuthError error = 3; - - - pub fn get_error(&self) -> &AuthError { - self.error.as_ref().unwrap_or_else(|| ::default_instance()) - } - pub fn clear_error(&mut self) { - self.error.clear(); - } - - pub fn has_error(&self) -> bool { - self.error.is_some() - } - - // Param is passed by value, moved - pub fn set_error(&mut self, v: AuthError) { - self.error = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_error(&mut self) -> &mut AuthError { - if self.error.is_none() { - self.error.set_default(); - } - self.error.as_mut().unwrap() - } - - // Take field - pub fn take_error(&mut self) -> AuthError { - self.error.take().unwrap_or_else(|| AuthError::new()) - } } impl ::protobuf::Message for DeviceAuthMessage { + const NAME: &'static str = "DeviceAuthMessage"; + fn is_initialized(&self) -> bool { for v in &self.challenge { if !v.is_initialized() { @@ -1507,21 +1348,20 @@ impl ::protobuf::Message for DeviceAuthMessage { true } - fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { - while !is.eof()? { - let (field_number, wire_type) = is.read_tag_unpack()?; - match field_number { - 1 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.challenge)?; + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.challenge)?; }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.response)?; + 18 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.response)?; }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.error)?; + 26 => { + ::protobuf::rt::read_singular_message_into_field(is, &mut self.error)?; }, - _ => { - ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; }, }; } @@ -1530,104 +1370,83 @@ impl ::protobuf::Message for DeviceAuthMessage { // Compute sizes of nested messages #[allow(unused_variables)] - fn compute_size(&self) -> u32 { + fn compute_size(&self) -> u64 { let mut my_size = 0; - if let Some(ref v) = self.challenge.as_ref() { + if let Some(v) = self.challenge.as_ref() { let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } - if let Some(ref v) = self.response.as_ref() { + if let Some(v) = self.response.as_ref() { let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } - if let Some(ref v) = self.error.as_ref() { + if let Some(v) = self.error.as_ref() { let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + my_size += 1 + ::protobuf::rt::compute_raw_varint64_size(len) + len; } - my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); - self.cached_size.set(my_size); + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); my_size } - fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { - if let Some(ref v) = self.challenge.as_ref() { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.challenge.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(1, v, os)?; } - if let Some(ref v) = self.response.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; + if let Some(v) = self.response.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(2, v, os)?; } - if let Some(ref v) = self.error.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; + if let Some(v) = self.error.as_ref() { + ::protobuf::rt::write_message_field_with_cached_size(3, v, os)?; } - os.write_unknown_fields(self.get_unknown_fields())?; + os.write_unknown_fields(self.special_fields.unknown_fields())?; ::std::result::Result::Ok(()) } - fn get_cached_size(&self) -> u32 { - self.cached_size.get() + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields } - fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { - &self.unknown_fields - } - - fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { - &mut self.unknown_fields - } - - fn as_any(&self) -> &dyn (::std::any::Any) { - self as &dyn (::std::any::Any) - } - fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { - self as &mut dyn (::std::any::Any) - } - fn into_any(self: ::std::boxed::Box) -> ::std::boxed::Box { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields } fn new() -> DeviceAuthMessage { DeviceAuthMessage::new() } - fn default_instance() -> &'static DeviceAuthMessage { - static instance: ::protobuf::rt::LazyV2 = ::protobuf::rt::LazyV2::INIT; - instance.get(DeviceAuthMessage::new) - } -} - -impl ::protobuf::Clear for DeviceAuthMessage { fn clear(&mut self) { self.challenge.clear(); self.response.clear(); self.error.clear(); - self.unknown_fields.clear(); + self.special_fields.clear(); } -} -impl ::protobuf::reflect::ProtobufValue for DeviceAuthMessage { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Message(self) + fn default_instance() -> &'static DeviceAuthMessage { + static instance: DeviceAuthMessage = DeviceAuthMessage { + challenge: ::protobuf::MessageField::none(), + response: ::protobuf::MessageField::none(), + error: ::protobuf::MessageField::none(), + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance } } -#[derive(Clone,PartialEq,Eq,Debug,Hash)] +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:cast.channel.SignatureAlgorithm) pub enum SignatureAlgorithm { + // @@protoc_insertion_point(enum_value:cast.channel.SignatureAlgorithm.UNSPECIFIED) UNSPECIFIED = 0, + // @@protoc_insertion_point(enum_value:cast.channel.SignatureAlgorithm.RSASSA_PKCS1v15) RSASSA_PKCS1v15 = 1, + // @@protoc_insertion_point(enum_value:cast.channel.SignatureAlgorithm.RSASSA_PSS) RSASSA_PSS = 2, } -impl ::protobuf::ProtobufEnum for SignatureAlgorithm { +impl ::protobuf::Enum for SignatureAlgorithm { + const NAME: &'static str = "SignatureAlgorithm"; + fn value(&self) -> i32 { *self as i32 } @@ -1641,17 +1460,11 @@ impl ::protobuf::ProtobufEnum for SignatureAlgorithm { } } - fn values() -> &'static [Self] { - static values: &'static [SignatureAlgorithm] = &[ - SignatureAlgorithm::UNSPECIFIED, - SignatureAlgorithm::RSASSA_PKCS1v15, - SignatureAlgorithm::RSASSA_PSS, - ]; - values - } -} - -impl ::std::marker::Copy for SignatureAlgorithm { + const VALUES: &'static [SignatureAlgorithm] = &[ + SignatureAlgorithm::UNSPECIFIED, + SignatureAlgorithm::RSASSA_PKCS1v15, + SignatureAlgorithm::RSASSA_PSS, + ]; } impl ::std::default::Default for SignatureAlgorithm { @@ -1660,19 +1473,19 @@ impl ::std::default::Default for SignatureAlgorithm { } } -impl ::protobuf::reflect::ProtobufValue for SignatureAlgorithm { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) - } -} -#[derive(Clone,PartialEq,Eq,Debug,Hash)] +#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)] +// @@protoc_insertion_point(enum:cast.channel.HashAlgorithm) pub enum HashAlgorithm { + // @@protoc_insertion_point(enum_value:cast.channel.HashAlgorithm.SHA1) SHA1 = 0, + // @@protoc_insertion_point(enum_value:cast.channel.HashAlgorithm.SHA256) SHA256 = 1, } -impl ::protobuf::ProtobufEnum for HashAlgorithm { +impl ::protobuf::Enum for HashAlgorithm { + const NAME: &'static str = "HashAlgorithm"; + fn value(&self) -> i32 { *self as i32 } @@ -1685,16 +1498,10 @@ impl ::protobuf::ProtobufEnum for HashAlgorithm { } } - fn values() -> &'static [Self] { - static values: &'static [HashAlgorithm] = &[ - HashAlgorithm::SHA1, - HashAlgorithm::SHA256, - ]; - values - } -} - -impl ::std::marker::Copy for HashAlgorithm { + const VALUES: &'static [HashAlgorithm] = &[ + HashAlgorithm::SHA1, + HashAlgorithm::SHA256, + ]; } impl ::std::default::Default for HashAlgorithm { @@ -1703,8 +1510,3 @@ impl ::std::default::Default for HashAlgorithm { } } -impl ::protobuf::reflect::ProtobufValue for HashAlgorithm { - fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { - ::protobuf::reflect::ReflectValueRef::Enum(::protobuf::ProtobufEnum::descriptor(self)) - } -} diff --git a/src/cast/proxies.rs b/src/cast/proxies.rs index 56fb01b74..b7133ccfb 100644 --- a/src/cast/proxies.rs +++ b/src/cast/proxies.rs @@ -1,5 +1,7 @@ /// Proxy classes for the `connection` channel. pub mod connection { + use serde_derive::Serialize; + #[derive(Serialize, Debug)] pub struct ConnectionRequest { #[serde(rename = "type")] @@ -11,6 +13,8 @@ pub mod connection { /// Proxy classes for the `heartbeat` channel. pub mod heartbeat { + use serde_derive::Serialize; + #[derive(Serialize, Debug)] pub struct HeartBeatRequest { #[serde(rename = "type")] @@ -20,6 +24,8 @@ pub mod heartbeat { /// Proxy classes for the `media` channel. pub mod media { + use serde_derive::{Deserialize, Serialize}; + #[derive(Serialize, Debug)] pub struct GetStatusRequest { #[serde(rename = "requestId")] @@ -280,6 +286,7 @@ pub mod media { /// Proxy classes for the `receiver` channel. pub mod receiver { + use serde_derive::{Deserialize, Serialize}; use std::borrow::Cow; #[derive(Serialize, Debug)] diff --git a/src/channels/receiver.rs b/src/channels/receiver.rs index a5194feac..c9fb018fb 100644 --- a/src/channels/receiver.rs +++ b/src/channels/receiver.rs @@ -255,16 +255,15 @@ where }) } - /// - /// Sends message over chromecast message bus + /// Broadcasts a message over a cast device's message bus. /// /// Receiver can observe messages using `context.addCustomMessageListener` with custom namespace. /// - ///```javascript, no_run + /// ```javascript, no_run /// context.addCustomMessageListener('urn:x-cast:com.example.castdata', function(customEvent) { - /// // do something with message + /// // do something with message /// }); - ///``` + /// ``` /// /// Namespace should start with `urn:x-cast:` /// @@ -272,7 +271,6 @@ where /// /// * `namespace` - Message namespace that should start with `urn:x-cast:`. /// * `message` - Message instance to send. - pub fn broadcast_message( &self, namespace: &str, diff --git a/src/errors.rs b/src/errors.rs index daea05d4a..42a8c390b 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,11 +1,12 @@ -use openssl::error::ErrorStack; -use openssl::ssl::HandshakeError; -use protobuf::ProtobufError; +use openssl::{error::ErrorStack, ssl::HandshakeError}; +use protobuf::Error as ProtobufError; use serde_json::error::Error as SerializationError; -use std::error::Error as StdError; -use std::fmt::{Display, Formatter, Result}; -use std::io::Error as IoError; -use std::net::TcpStream; +use std::{ + error::Error as StdError, + fmt::{Display, Formatter, Result}, + io::Error as IoError, + net::TcpStream, +}; /// Consolidates possible error types that can occur in the OpenSSL lib. #[derive(Debug)] diff --git a/src/lib.rs b/src/lib.rs index bbb228f4e..9938faba4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,14 +1,4 @@ -#![doc(html_root_url = "https://azasypkin.github.io/rust-cast/")] - -extern crate byteorder; -#[macro_use] -extern crate log; -extern crate openssl; -extern crate protobuf; -extern crate serde; -#[macro_use] -extern crate serde_derive; -extern crate serde_json; +#![deny(warnings)] mod cast; pub mod channels; @@ -16,15 +6,16 @@ pub mod errors; pub mod message_manager; mod utils; -use std::borrow::Cow; -use std::net::TcpStream; +use std::{borrow::Cow, net::TcpStream}; use openssl::ssl::{SslConnector, SslMethod, SslStream, SslVerifyMode}; -use channels::connection::{ConnectionChannel, ConnectionResponse}; -use channels::heartbeat::{HeartbeatChannel, HeartbeatResponse}; -use channels::media::{MediaChannel, MediaResponse}; -use channels::receiver::{ReceiverChannel, ReceiverResponse}; +use channels::{ + connection::{ConnectionChannel, ConnectionResponse}, + heartbeat::{HeartbeatChannel, HeartbeatResponse}, + media::{MediaChannel, MediaResponse}, + receiver::{ReceiverChannel, ReceiverResponse}, +}; use errors::Error; @@ -102,9 +93,10 @@ impl<'a> CastDevice<'a> { { let host = host.into(); - debug!( + log::debug!( "Establishing connection with cast device at {}:{}...", - host, port + host, + port ); let connector = SslConnector::builder(SslMethod::tls())?.build(); @@ -144,9 +136,10 @@ impl<'a> CastDevice<'a> { { let host = host.into(); - debug!( + log::debug!( "Establishing non-verified connection with cast device at {}:{}...", - host, port + host, + port ); let mut builder = SslConnector::builder(SslMethod::tls())?; @@ -155,9 +148,10 @@ impl<'a> CastDevice<'a> { let connector = builder.build(); let tcp_stream = TcpStream::connect((host.as_ref(), port))?; - debug!( + log::debug!( "Connection with {}:{} successfully established.", - host, port + host, + port ); CastDevice::connect_to_device(connector.connect(host.as_ref(), tcp_stream)?) diff --git a/src/message_manager.rs b/src/message_manager.rs index 95f83c1eb..03d3ad2d1 100644 --- a/src/message_manager.rs +++ b/src/message_manager.rs @@ -3,7 +3,14 @@ use std::{ ops::{Deref, DerefMut}, }; -use crate::{cast::cast_channel, errors::Error, utils}; +use crate::{ + cast::{ + cast_channel, + cast_channel::cast_message::{PayloadType, ProtocolVersion}, + }, + errors::Error, + utils, +}; struct Lock( #[cfg(feature = "thread_safe")] std::sync::Mutex, @@ -128,7 +135,7 @@ where pub fn send(&self, message: CastMessage) -> Result<(), Error> { let mut raw_message = cast_channel::CastMessage::new(); - raw_message.set_protocol_version(cast_channel::CastMessage_ProtocolVersion::CASTV2_1_0); + raw_message.set_protocol_version(ProtocolVersion::CASTV2_1_0); raw_message.set_namespace(message.namespace); raw_message.set_source_id(message.source); @@ -136,12 +143,12 @@ where match message.payload { CastMessagePayload::String(payload) => { - raw_message.set_payload_type(cast_channel::CastMessage_PayloadType::STRING); + raw_message.set_payload_type(PayloadType::STRING); raw_message.set_payload_utf8(payload); } CastMessagePayload::Binary(payload) => { - raw_message.set_payload_type(cast_channel::CastMessage_PayloadType::BINARY); + raw_message.set_payload_type(PayloadType::BINARY); raw_message.set_payload_binary(payload); } }; @@ -155,7 +162,7 @@ where writer.write_all(&message_length_buffer)?; writer.write_all(&message_content_buffer)?; - debug!("Message sent: {:?}", raw_message); + log::debug!("Message sent: {:?}", raw_message); Ok(()) } @@ -265,18 +272,18 @@ where let raw_message = utils::from_vec::(buffer.to_vec())?; - debug!("Message received: {:?}", raw_message); + log::debug!("Message received: {:?}", raw_message); Ok(CastMessage { - namespace: raw_message.get_namespace().to_string(), - source: raw_message.get_source_id().to_string(), - destination: raw_message.get_destination_id().to_string(), - payload: match raw_message.get_payload_type() { - cast_channel::CastMessage_PayloadType::STRING => { - CastMessagePayload::String(raw_message.get_payload_utf8().to_string()) + namespace: raw_message.namespace().to_string(), + source: raw_message.source_id().to_string(), + destination: raw_message.destination_id().to_string(), + payload: match raw_message.payload_type() { + PayloadType::STRING => { + CastMessagePayload::String(raw_message.payload_utf8().to_string()) } - cast_channel::CastMessage_PayloadType::BINARY => { - CastMessagePayload::Binary(raw_message.get_payload_binary().to_owned()) + PayloadType::BINARY => { + CastMessagePayload::Binary(raw_message.payload_binary().to_owned()) } }, })