text
stringlengths
8
4.13M
pub mod bit_wrapper; pub mod e256; pub mod ec; pub mod field; pub mod gf256; pub mod operation; pub mod poly;
use paige::*; fn main() { let page = Page::new(&[ Tag::Html.content(&[ Tag::Head.content(&[ Tag::Meta.attributes(&[Attr::Charset("UTF-8".into())]) ]), Tag::Body.style(&[Prop::Background("green".into())]).content(&[]) ]) ]); println!("{}", page.format(false)); println!(""); println!("{}", page.format(true)); }
use super::BufferTag; use crate::tools::ctags::CTAGS_HAS_JSON_FEATURE; use rayon::prelude::*; use std::io::Result; use std::ops::Deref; use std::path::Path; use std::process::Stdio; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; use subprocess::{Exec as SubprocessCommand, Redirection}; use tokio::process::Command as TokioCommand; use types::ClapItem; const CONTEXT_KINDS: &[&str] = &[ "function", "method", "module", "macro", "implementation", "interface", ]; const CONTEXT_SUPERSET: &[&str] = &[ "function", "method", "module", "macro", "implementation", "interface", "struct", "field", "typedef", "enumerator", ]; fn subprocess_cmd_in_json_format(file: impl AsRef<std::ffi::OsStr>) -> SubprocessCommand { // Redirect stderr otherwise the warning message might occur `ctags: Warning: ignoring null tag...` SubprocessCommand::cmd("ctags") .stderr(Redirection::None) .arg("--fields=+n") .arg("--output-format=json") .arg(file) } fn subprocess_cmd_in_raw_format(file: impl AsRef<std::ffi::OsStr>) -> SubprocessCommand { // Redirect stderr otherwise the warning message might occur `ctags: Warning: ignoring null tag...` SubprocessCommand::cmd("ctags") .stderr(Redirection::None) .arg("--fields=+Kn") .arg("-f") .arg("-") .arg(file) } fn tokio_cmd_in_json_format(file: &Path) -> TokioCommand { let mut tokio_cmd = TokioCommand::new("ctags"); tokio_cmd .stderr(Stdio::null()) .arg("--fields=+n") .arg("--output-format=json") .arg(file); tokio_cmd } fn tokio_cmd_in_raw_format(file: &Path) -> TokioCommand { let mut tokio_cmd = TokioCommand::new("ctags"); tokio_cmd .stderr(Stdio::null()) .arg("--fields=+Kn") .arg("-f") .arg("-") .arg(file); tokio_cmd } fn find_context_tag(superset_tags: Vec<BufferTag>, at: usize) -> Option<BufferTag> { match superset_tags.binary_search_by_key(&at, |tag| tag.line_number) { Ok(_l) => None, // Skip if the line is exactly a tag line. Err(_l) => { let context_tags = superset_tags .into_par_iter() .filter(|tag| CONTEXT_KINDS.contains(&tag.kind.as_ref())) .collect::<Vec<_>>(); match context_tags.binary_search_by_key(&at, |tag| tag.line_number) { Ok(_) => None, Err(l) => { let maybe_idx = l.checked_sub(1); // use the previous item. maybe_idx.and_then(|idx| context_tags.into_iter().nth(idx)) } } } } } /// Async version of [`current_context_tag`]. pub async fn current_context_tag_async(file: &Path, at: usize) -> Option<BufferTag> { let superset_tags = if *CTAGS_HAS_JSON_FEATURE.deref() { let cmd = tokio_cmd_in_json_format(file); collect_superset_context_tags_async(cmd, BufferTag::from_ctags_json, at) .await .ok()? } else { let cmd = tokio_cmd_in_raw_format(file); collect_superset_context_tags_async(cmd, BufferTag::from_ctags_raw, at) .await .ok()? }; find_context_tag(superset_tags, at) } /// Returns the method/function context associated with line `at`. pub fn current_context_tag(file: &Path, at: usize) -> Option<BufferTag> { let superset_tags = if *CTAGS_HAS_JSON_FEATURE.deref() { let cmd = subprocess_cmd_in_json_format(file); collect_superset_context_tags(cmd, BufferTag::from_ctags_json, at).ok()? } else { let cmd = subprocess_cmd_in_raw_format(file); collect_superset_context_tags(cmd, BufferTag::from_ctags_raw, at).ok()? }; find_context_tag(superset_tags, at) } pub fn buffer_tags_lines( file: impl AsRef<std::ffi::OsStr>, force_raw: bool, ) -> Result<Vec<String>> { let (tags, max_name_len) = if *CTAGS_HAS_JSON_FEATURE.deref() && !force_raw { let cmd = subprocess_cmd_in_json_format(file); collect_buffer_tags(cmd, BufferTag::from_ctags_json)? } else { let cmd = subprocess_cmd_in_raw_format(file); collect_buffer_tags(cmd, BufferTag::from_ctags_raw)? }; Ok(tags .par_iter() .map(|s| s.format_buffer_tag(max_name_len)) .collect::<Vec<_>>()) } pub fn fetch_buffer_tags(file: impl AsRef<std::ffi::OsStr>) -> Result<Vec<BufferTag>> { let (mut tags, _max_name_len) = if *CTAGS_HAS_JSON_FEATURE.deref() { let cmd = subprocess_cmd_in_json_format(file); collect_buffer_tags(cmd, BufferTag::from_ctags_json)? } else { let cmd = subprocess_cmd_in_raw_format(file); collect_buffer_tags(cmd, BufferTag::from_ctags_raw)? }; tags.par_sort_unstable_by_key(|x| x.line_number); Ok(tags) } pub fn buffer_tag_items( file: impl AsRef<std::ffi::OsStr>, force_raw: bool, ) -> Result<Vec<Arc<dyn ClapItem>>> { let (tags, max_name_len) = if *CTAGS_HAS_JSON_FEATURE.deref() && !force_raw { let cmd = subprocess_cmd_in_json_format(file); collect_buffer_tags(cmd, BufferTag::from_ctags_json)? } else { let cmd = subprocess_cmd_in_raw_format(file); collect_buffer_tags(cmd, BufferTag::from_ctags_raw)? }; Ok(tags .into_par_iter() .map(|tag| Arc::new(tag.into_buffer_tag_item(max_name_len)) as Arc<dyn ClapItem>) .collect::<Vec<_>>()) } fn collect_buffer_tags( cmd: SubprocessCommand, parse_tag: impl Fn(&str) -> Option<BufferTag> + Send + Sync, ) -> Result<(Vec<BufferTag>, usize)> { let max_name_len = AtomicUsize::new(0); let tags = crate::process::subprocess::exec(cmd)? .flatten() .par_bridge() .filter_map(|s| { let maybe_tag = parse_tag(&s); if let Some(ref tag) = maybe_tag { max_name_len.fetch_max(tag.name.len(), Ordering::SeqCst); } maybe_tag }) .collect::<Vec<_>>(); Ok((tags, max_name_len.into_inner())) } fn collect_superset_context_tags( cmd: SubprocessCommand, parse_tag: impl Fn(&str) -> Option<BufferTag> + Send + Sync, target_lnum: usize, ) -> Result<Vec<BufferTag>> { let mut tags = crate::process::subprocess::exec(cmd)? .flatten() .par_bridge() .filter_map(|s| parse_tag(&s)) // the line of method/function name is lower. .filter(|tag| { tag.line_number <= target_lnum && CONTEXT_SUPERSET.contains(&tag.kind.as_ref()) }) .collect::<Vec<_>>(); tags.par_sort_unstable_by_key(|x| x.line_number); Ok(tags) } async fn collect_superset_context_tags_async( cmd: TokioCommand, parse_tag: impl Fn(&str) -> Option<BufferTag> + Send + Sync, target_lnum: usize, ) -> Result<Vec<BufferTag>> { let mut cmd = cmd; let mut tags = cmd .output() .await? .stdout .par_split(|x| x == &b'\n') .filter_map(|s| parse_tag(&String::from_utf8_lossy(s))) // the line of method/function name is lower. .filter(|tag| { tag.line_number <= target_lnum && CONTEXT_SUPERSET.contains(&tag.kind.as_ref()) }) .collect::<Vec<_>>(); tags.par_sort_unstable_by_key(|x| x.line_number); Ok(tags) }
// Copyright 2022 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. use std::any::Any; use std::ops::Range; use std::sync::Arc; use common_exception::ErrorCode; use common_exception::Result; use common_expression::BlockMetaInfo; use common_expression::BlockMetaInfoDowncast; use common_expression::BlockMetaInfoPtr; use common_expression::RemoteExpr; use common_expression::TableDataType; use common_expression::TableSchemaRef; use storages_common_table_meta::meta::BlockMeta; use storages_common_table_meta::meta::ColumnStatistics; #[derive(serde::Serialize, serde::Deserialize, Clone, Debug, Default, PartialEq, Eq)] pub struct BlockMetaIndex { // {segment|block}_id is used in `InternalColumnMeta` to generate internal column data, // where older data has smaller id, but {segment|block}_idx is opposite, // so {segment|block}_id = {segment|block}_count - {segment|block}_idx - 1 pub segment_idx: usize, pub block_idx: usize, pub range: Option<Range<usize>>, pub block_id: usize, pub block_location: String, pub segment_id: usize, pub segment_location: String, pub snapshot_location: Option<String>, } #[typetag::serde(name = "block_meta_index")] impl BlockMetaInfo for BlockMetaIndex { fn as_any(&self) -> &dyn Any { self } fn equals(&self, info: &Box<dyn BlockMetaInfo>) -> bool { match BlockMetaIndex::downcast_ref_from(info) { None => false, Some(other) => self == other, } } fn clone_self(&self) -> Box<dyn BlockMetaInfo> { Box::new(self.clone()) } } impl BlockMetaIndex { pub fn from_meta(info: &BlockMetaInfoPtr) -> Result<&BlockMetaIndex> { match BlockMetaIndex::downcast_ref_from(info) { Some(part_ref) => Ok(part_ref), None => Err(ErrorCode::Internal( "Cannot downcast from BlockMetaInfo to BlockMetaIndex.", )), } } } /// TopN prunner. /// Pruning for order by x limit N. pub struct TopNPrunner { schema: TableSchemaRef, sort: Vec<(RemoteExpr<String>, bool, bool)>, limit: usize, } impl TopNPrunner { pub fn create( schema: TableSchemaRef, sort: Vec<(RemoteExpr<String>, bool, bool)>, limit: usize, ) -> Self { Self { schema, sort, limit, } } } impl TopNPrunner { pub fn prune( &self, metas: Vec<(BlockMetaIndex, Arc<BlockMeta>)>, ) -> Result<Vec<(BlockMetaIndex, Arc<BlockMeta>)>> { if self.sort.len() != 1 { return Ok(metas); } if self.limit >= metas.len() { return Ok(metas); } let (sort, asc, nulls_first) = &self.sort[0]; // Currently, we only support topn on single-column sort. // TODO: support monadic + multi expression + order by cluster key sort. // Currently, we only support topn on single-column sort. // TODO: support monadic + multi expression + order by cluster key sort. let column = if let RemoteExpr::ColumnRef { id, .. } = sort { id } else { return Ok(metas); }; let sort_idx = if let Ok(index) = self.schema.index_of(column.as_str()) { index as u32 } else { return Ok(metas); }; // String Type min/max is truncated if matches!( self.schema.field(sort_idx as usize).data_type(), TableDataType::String ) { return Ok(metas); } let mut id_stats = metas .iter() .map(|(id, meta)| { let stat = meta.col_stats.get(&sort_idx).ok_or_else(|| { ErrorCode::UnknownException(format!( "Unable to get the colStats by ColumnId: {}", sort_idx )) })?; Ok((id.clone(), stat.clone(), meta.clone())) }) .collect::<Result<Vec<(BlockMetaIndex, ColumnStatistics, Arc<BlockMeta>)>>>()?; id_stats.sort_by(|a, b| { if a.1.null_count + b.1.null_count != 0 && *nulls_first { return a.1.null_count.cmp(&b.1.null_count).reverse(); } // no nulls if *asc { a.1.min.cmp(&b.1.min) } else { a.1.max.cmp(&b.1.max).reverse() } }); Ok(id_stats .iter() .map(|s| (s.0.clone(), s.2.clone())) .take(self.limit) .collect()) } }
use std::env; use std::error::Error; use std::fs; use std::path::PathBuf; use std::process::Command; use quote::{format_ident, quote}; fn main() -> Result<(), Box<dyn Error>> { let mut functions = vec![]; let mut tests = vec![]; for entry in fs::read_dir("vendor")? { let repo_path = entry?.path(); let language = repo_path .file_name() .expect("tree-sitter language repo paths must have a file name") .to_str() .expect("tree-sitter language repo paths must be UTF-8") .trim_start_matches("tree-sitter-"); let src = repo_path.join("src"); let vendor_dir = format!("tree-sitter-{}", language); cc::Build::new() .warnings(false) .include(&src) .file(src.join("parser.c")) .file(src.join("scanner.c")) .compile(&vendor_dir); let language_ident = format_ident!("{}", language); let tree_sitter_function = format_ident!("tree_sitter_{}", language); let highlight_query_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?) .join("vendor") .join(vendor_dir) .join("queries/highlights.scm"); let highlight_query_path = highlight_query_path .to_str() .expect("expected path to be UTF-8"); functions.push(quote! { pub fn #language_ident() -> (Language, Query) { extern "C" { fn #tree_sitter_function() -> tree_sitter::Language; } let language = unsafe { #tree_sitter_function() }; let query = Query::new( language, include_str!(#highlight_query_path), ).expect("unable to parse highlight query"); (language, query) } }); tests.push(quote! { #[test] fn #language_ident() { println!("{:?}", super::#language_ident()); } }); } let tokens = quote! { use tree_sitter::{Language, Query}; #(#functions)* #[cfg(test)] mod tests { #(#tests)* } }; let out_dir = PathBuf::from(env::var("OUT_DIR")?); let out_file = out_dir.join("generated.rs"); fs::write(&out_file, tokens.to_string())?; // Attempt to format the output for better human readability. let _ = Command::new("rustfmt") .args(&["--emit", "files"]) .arg(out_file) .status(); Ok(()) }
use thiserror::Error; #[derive(Error, Debug)] pub enum PmError { #[error("index already exists")] IndexExists, }
mod cell; mod cells; use std::iter::Iterator; use rand::{self, Rng}; pub use self::cells::Cells; pub use self::cell::Cell; pub use self::cell::Team; pub struct GameOfLife { width: usize, height: usize, pub cells: Cells, } impl GameOfLife { pub fn new(width: usize, height: usize) -> GameOfLife { GameOfLife { width: width, height: height, cells: Cells::new(width, height), } } pub fn tick(&mut self) { let mut new_cells = self.cells.clone(); for x in 0..self.width { for y in 0..self.height { let neighbors = self.cells.get_neighbors(x, y); let parents: Vec<&Cell> = neighbors.iter().filter(|c| c.alive).map(|c| *c).collect(); let population = parents.len(); let cell = &mut self.cells.get(x, y).unwrap(); if cell.alive && (population < 2 || population > 3) { new_cells.get_mut(x, y).unwrap().alive = false; } else if !cell.alive && population == 3 { let new_cell = new_cells.get_mut(x, y).unwrap(); new_cell.alive = true; new_cell.inherit_from(&parents[..]); } } } self.cells = new_cells; } #[allow(dead_code)] pub fn clear(&mut self) { for x in 0..self.width { for y in 0..self.height { self.cells.get_mut(x, y).unwrap().alive = false; } } } #[allow(dead_code)] pub fn randomize(&mut self) { let mut rng = rand::thread_rng(); for x in 0..self.width { for y in 0..self.height { self.cells.set(x, y, rng.gen()); } } } #[allow(dead_code)] pub fn glider(&mut self) { self.clear(); let indexes = [(2, 1), (3, 2), (3, 3), (2, 3), (1, 3)]; for &(x, y) in &indexes { self.cells.get_mut(x, y).unwrap().alive = true; } } }
use crate::lib::{default_sub_command, file_to_lines, parse_lines, Command}; use anyhow::Error; use clap::{value_t_or_exit, App, Arg, ArgMatches, SubCommand}; use nom::{branch::alt, character::complete, combinator::map, multi::many1}; use simple_error::SimpleError; use strum::VariantNames; use strum_macros::{EnumString, EnumVariantNames}; pub const SEATING_SYSTEM: Command = Command::new(sub_command, "seating-system", run); #[derive(Debug)] struct SeatingSystemArgs { file: String, tolerance: usize, adjacency_definition: AdjacencyDefinition, } #[derive(Debug, Clone, PartialEq, Copy)] enum FloorTile { Floor, Seat { occupied: bool }, } #[derive(Debug, EnumString, EnumVariantNames)] #[strum(serialize_all = "kebab_case")] enum AdjacencyDefinition { DirectlyNextTo, LineOfSight, } fn sub_command() -> App<'static, 'static> { default_sub_command( &SEATING_SYSTEM, "Takes a file with a seating chart and finds stats about people sitting", "Path to the input file. Each line contains one row of seats.", ) .arg( Arg::with_name("tolerance") .short("t") .help("The amount of adjacent seats people are willing to sit beside before leaving") .takes_value(true) .required(true), ) .arg( Arg::with_name("adjacency") .short("a") .help( "The definition of adjaceny. The possible definitions are as follows:\n\n\ directly-next-to: Tiles directly next to the target tile are adjacent.\n\n\ line-of-sight: The first Seat tile in a direct is adjacent.\n", ) .takes_value(true) .possible_values(&AdjacencyDefinition::VARIANTS) .required(true), ) .subcommand( SubCommand::with_name("part1") .about( "Finds an equalibrium for steating arrangements with a tolerance of 4, and \ adjacency of directly-next-to and then returns the number of occupied seats \ with the default input.", ) .version("1.0.0"), ) .subcommand( SubCommand::with_name("part2") .about( "Finds an equalibrium for steating arrangements with a tolerance of 5, and \ adjacency of line-of-sight and then returns the number of occupied seats \ with the default input.", ) .version("1.0.0"), ) } fn run(arguments: &ArgMatches) -> Result<(), Error> { let seating_system_arguments = match arguments.subcommand_name() { Some("part1") => SeatingSystemArgs { file: "day11/input.txt".to_string(), tolerance: 4, adjacency_definition: AdjacencyDefinition::DirectlyNextTo, }, Some("part2") => SeatingSystemArgs { file: "day11/input.txt".to_string(), tolerance: 5, adjacency_definition: AdjacencyDefinition::LineOfSight, }, _ => SeatingSystemArgs { file: value_t_or_exit!(arguments.value_of("file"), String), tolerance: value_t_or_exit!(arguments.value_of("tolerance"), usize), adjacency_definition: value_t_or_exit!( arguments.value_of("adjacency"), AdjacencyDefinition ), }, }; process_seat_layout(&seating_system_arguments) .map(|result| { println!("{:#?}", result); }) .map(|_| ()) } fn process_seat_layout(seating_system_arguments: &SeatingSystemArgs) -> Result<usize, Error> { file_to_lines(&seating_system_arguments.file) .and_then(|lines| parse_lines(lines, parse_row_of_seats)) .map(|seating_arrangement| { find_equalibrium( &seating_arrangement, &seating_system_arguments.tolerance, &seating_system_arguments.adjacency_definition, ) .into_iter() .fold(0usize, |acc, row| { acc + row .into_iter() .filter(|tile| match tile { FloorTile::Seat { occupied: true } => true, _ => false, }) .count() }) }) } fn find_equalibrium( seating_arrangement: &Vec<Vec<FloorTile>>, tolerance: &usize, adjacency_definition: &AdjacencyDefinition, ) -> Vec<Vec<FloorTile>> { let mut previous_arrangement = seating_arrangement.to_vec(); loop { let next_arrangement = iterate_seats(&previous_arrangement, tolerance, adjacency_definition); if next_arrangement == *previous_arrangement { break; } previous_arrangement = next_arrangement; } previous_arrangement } fn iterate_seats( seating_arrangement: &Vec<Vec<FloorTile>>, tolerance: &usize, adjacency_definition: &AdjacencyDefinition, ) -> Vec<Vec<FloorTile>> { seating_arrangement .into_iter() .enumerate() .map(|(y, row)| { row.into_iter() .enumerate() .map(|(x, tile)| match tile { FloorTile::Seat { occupied: true } => { let adjacent_tiles = match adjacency_definition { AdjacencyDefinition::DirectlyNextTo => { get_adjacent_tiles(&x, &y, seating_arrangement) } AdjacencyDefinition::LineOfSight => { get_line_of_sight_seats(&x, &y, seating_arrangement) } }; match count_occupided_seats(adjacent_tiles) { _x if _x >= *tolerance => FloorTile::Seat { occupied: false }, _ => FloorTile::Seat { occupied: true }, } } FloorTile::Seat { occupied: false } => { let adjacent_tiles = match adjacency_definition { AdjacencyDefinition::DirectlyNextTo => { get_adjacent_tiles(&x, &y, seating_arrangement) } AdjacencyDefinition::LineOfSight => { get_line_of_sight_seats(&x, &y, seating_arrangement) } }; match count_occupided_seats(adjacent_tiles) { 0 => FloorTile::Seat { occupied: true }, _ => FloorTile::Seat { occupied: false }, } } FloorTile::Floor => FloorTile::Floor, }) .collect() }) .collect() } fn count_occupided_seats(seats: Vec<FloorTile>) -> usize { seats .into_iter() .filter(|tile| match tile { FloorTile::Seat { occupied: true } => true, _ => false, }) .count() } fn get_line_of_sight_seats( x: &usize, y: &usize, seating_arrangement: &Vec<Vec<FloorTile>>, ) -> Vec<FloorTile> { let mut result = Vec::new(); let y_max = seating_arrangement.len() - 1; let x_max = seating_arrangement[0].len() - 1; // up left traverse_until_seat( x, y, seating_arrangement, Option::Some(0), Option::Some(0), &std::ops::Sub::sub, &std::ops::Sub::sub, ) .iter() .for_each(|tile| result.push(*tile)); // up traverse_until_seat( x, y, seating_arrangement, Option::None, Option::Some(0), &std::ops::Mul::mul, &std::ops::Sub::sub, ) .iter() .for_each(|tile| result.push(*tile)); // up right traverse_until_seat( x, y, seating_arrangement, Option::Some(x_max), Option::Some(0), &std::ops::Add::add, &std::ops::Sub::sub, ) .iter() .for_each(|tile| result.push(*tile)); // left traverse_until_seat( x, y, seating_arrangement, Option::Some(0), Option::None, &std::ops::Sub::sub, &std::ops::Mul::mul, ) .iter() .for_each(|tile| result.push(*tile)); // right traverse_until_seat( x, y, seating_arrangement, Option::Some(x_max), Option::None, &std::ops::Add::add, &std::ops::Mul::mul, ) .iter() .for_each(|tile| result.push(*tile)); // left down traverse_until_seat( x, y, seating_arrangement, Option::Some(0), Option::Some(y_max), &std::ops::Sub::sub, &std::ops::Add::add, ) .iter() .for_each(|tile| result.push(*tile)); // down traverse_until_seat( x, y, seating_arrangement, Option::None, Option::Some(y_max), &std::ops::Mul::mul, &std::ops::Add::add, ) .iter() .for_each(|tile| result.push(*tile)); // down right traverse_until_seat( x, y, seating_arrangement, Option::Some(x_max), Option::Some(y_max), &std::ops::Add::add, &std::ops::Add::add, ) .iter() .for_each(|tile| result.push(*tile)); result } fn traverse_until_seat( x: &usize, y: &usize, seating_arrangement: &Vec<Vec<FloorTile>>, x_stop: Option<usize>, y_stop: Option<usize>, x_move: &dyn Fn(usize, usize) -> usize, y_move: &dyn Fn(usize, usize) -> usize, ) -> Option<FloorTile> { let mut current_x = *x; let mut current_y = *y; loop { if x_stop.map(|stop| current_x == stop).unwrap_or(false) || y_stop.map(|stop| current_y == stop).unwrap_or(false) { break; } current_x = x_move(current_x, 1); current_y = y_move(current_y, 1); match seating_arrangement[current_y][current_x] { FloorTile::Seat { occupied: _ } => { return Option::Some(seating_arrangement[current_y][current_x]); } FloorTile::Floor => (), } } Option::None } fn get_adjacent_tiles( x: &usize, y: &usize, seating_arrangement: &Vec<Vec<FloorTile>>, ) -> Vec<FloorTile> { let mut result = Vec::new(); if y > &0 { result.extend(find_adjacent_tiles_in_row( x, &seating_arrangement[y - 1], true, )); } result.extend(find_adjacent_tiles_in_row( x, &seating_arrangement[*y], false, )); if *y < seating_arrangement.len() - 1 { result.extend(find_adjacent_tiles_in_row( x, &seating_arrangement[y + 1], true, )); } result } fn find_adjacent_tiles_in_row(x: &usize, row: &Vec<FloorTile>, include_x: bool) -> Vec<FloorTile> { let mut result = Vec::new(); if x > &0 { result.push(row[x - 1]); } if include_x { result.push(row[*x]); } if *x < row.len() - 1 { result.push(row[x + 1]); } result } fn parse_row_of_seats(line: &String) -> Result<Vec<FloorTile>, Error> { many1(alt(( map(complete::char('.'), |_| FloorTile::Floor), map(complete::char('#'), |_| FloorTile::Seat { occupied: true }), map(complete::char('L'), |_| FloorTile::Seat { occupied: false }), )))(line.as_str()) .map(|(_, seating_arrangement)| seating_arrangement) .map_err(|_: nom::Err<nom::error::Error<&str>>| SimpleError::new("Parse failure").into()) }
#![no_std] #![deny(unsafe_code)] extern crate stm32f4xx_hal as hal; use crate::hal::{i2c, i2s}; use crate::register::*; mod register; pub mod wave_header; const DEVICE_ADDRESS: u8 = 0x1A; #[derive(Debug)] pub enum Error { I2c(i2c::Error), I2s(i2s::Error), InvalidInputData, } pub struct Wm8960<I2C, I2S> { i2c: I2C, i2s: I2S, } impl<I2C, I2S> Wm8960<I2C, I2S> where I2C: embedded_hal::blocking::i2c::Write<Error = i2c::Error>, I2S: i2s::Write<u16, Error = i2s::Error>, { pub fn new(i2c: I2C, i2s: I2S) -> Result<Self, Error> { let mut wm = Wm8960 { i2c, i2s }; // Reset wm.write_control_register(Register::Reset, 0)?; // Set power source let mut val = PwrMgmt1(0); val.set_vref(true); val.set_vmidsel(0b11); wm.write_control_register(Register::PwrMgmt1, val.0)?; let mut val = PwrMgmt2(0); val.set_spkr(true); val.set_spkl(true); val.set_rout1(true); val.set_lout1(true); val.set_dacr(true); val.set_dacl(true); wm.write_control_register(Register::PwrMgmt2, val.0)?; let mut val = PwrMgmt3(0); val.set_romix(true); val.set_lomix(true); wm.write_control_register(Register::PwrMgmt3, val.0)?; // Configure clock // MCLK->div1->SYSCLK->DAC/ADC sample Freq // = 25MHz(MCLK)/2*256 = 48.8kHz let val = Clocking(0); wm.write_control_register(Register::Clocking, val.0)?; // Configure ADC/DAC let val = Ctr1(0); wm.write_control_register(Register::Ctr1, val.0)?; // Configure audio interface // I2S format 16 bits word length let mut val = AudioIface(0); val.set_format(0b10); wm.write_control_register(Register::AudioIface, val.0)?; // Configure HP_L and HP_R OUTPUTS let mut val = Lout1Vol(0); val.set_lout1vol(0x6F); val.set_out1vu(true); wm.write_control_register(Register::Lout1Vol, val.0)?; let mut val = Rout1Vol(0); val.set_rout1vol(0x6F); val.set_out1vu(true); wm.write_control_register(Register::Rout1Vol, val.0)?; // Configure SPK_RP and SPK_RN let mut val = Lout2Vol(0); val.set_spklvol(0x7F); val.set_spkvu(true); wm.write_control_register(Register::Lout2Vol, val.0)?; let mut val = Rout2Vol(0); val.set_spkrvol(0x7F); val.set_spkvu(true); wm.write_control_register(Register::Rout2Vol, val.0)?; // Enable the OUTPUTS let mut val = ClassdCtr1(0); val.set_reserved(0b110111); val.set_spkopen(0b11); wm.write_control_register(Register::ClassdCtr1, val.0)?; // Configure DAC volume let mut val = LdacVol(0); val.set_ldacvol(0xFF); val.set_dacvu(true); wm.write_control_register(Register::LdacVol, val.0)?; let mut val = RdacVol(0); val.set_rdacvol(0xFF); val.set_dacvu(true); wm.write_control_register(Register::RdacVol, val.0)?; // 3D // wm.write_reg(0x10, 0x001F); // Configure MIXER let mut val = LoutMix1(0); val.set_li2lo(true); val.set_ld2lo(true); wm.write_control_register(Register::LoutMix1, val.0)?; let mut val = RoutMix1(0); val.set_ri2ro(true); val.set_rd2ro(true); wm.write_control_register(Register::RoutMix1, val.0)?; // Jack Detect let mut val = Addctr2(0); val.set_hpswen(true); wm.write_control_register(Register::Addctr2, val.0)?; let mut val = Addctr1(0); val.set_toen(true); val.set_toclksel(true); val.set_vsel(0b11); val.set_tsden(true); wm.write_control_register(Register::Addctr1, val.0)?; let mut val = Addctr4(0); val.set_mbsel(true); val.set_hpsel(0b10); wm.write_control_register(Register::Addctr4, val.0)?; Ok(wm) } pub fn play_audio(&mut self, data: &[u16]) -> Result<(), Error> { self.i2s.write(data)?; Ok(()) } /// Write a 9-bit control register fn write_control_register(&mut self, reg: Register, data: u16) -> Result<(), Error> { let bytes = [ (reg.addr() << 1) | (data >> 8) as u8 & 0x1, (data & 0xFF) as u8, ]; self.i2c.write(DEVICE_ADDRESS, &bytes)?; Ok(()) } } impl From<i2c::Error> for Error { fn from(e: i2c::Error) -> Self { Error::I2c(e) } } impl From<i2s::Error> for Error { fn from(e: i2s::Error) -> Self { Error::I2s(e) } }
use crate::{ error::{ProtoError, ProtoErrorKind, ProtoErrorResultExt}, message::{ ChannelName, ChatCapabilitiesFlags, NowChatMsg, NowChatSyncMsg, NowChatTextMsg, NowString65535, NowVirtualChannel, }, sm::{VirtChannelSMResult, VirtualChannelSM}, }; use std::{cell::RefCell, rc::Rc, str::FromStr}; pub type ChatDataRc = Rc<RefCell<ChatData>>; pub type TimestampFn = Box<dyn FnMut() -> u32>; pub trait ChatChannelCallbackTrait { fn on_message<'msg>(&mut self, text_msg: &NowChatTextMsg) -> VirtChannelSMResult<'msg> { #![allow(unused_variables)] Ok(None) } fn on_synced<'msg>(&mut self) -> VirtChannelSMResult<'msg> { Ok(None) } } sa::assert_obj_safe!(ChatChannelCallbackTrait); pub struct DummyChatChannelCallback; impl ChatChannelCallbackTrait for DummyChatChannelCallback {} #[derive(Debug, Clone, PartialEq)] pub struct ChatData { pub friendly_name: String, pub status_text: String, pub distant_friendly_name: String, pub distant_status_text: String, pub capabilities: ChatCapabilitiesFlags, } impl Default for ChatData { fn default() -> Self { Self::new() } } impl ChatData { pub fn new() -> Self { Self { friendly_name: "Anonymous".to_owned(), status_text: "None".to_owned(), distant_friendly_name: "Unknown".to_owned(), distant_status_text: "None".to_owned(), capabilities: ChatCapabilitiesFlags::new_empty(), } } pub fn capabilities(self, capabilities: ChatCapabilitiesFlags) -> Self { Self { capabilities, ..self } } pub fn friendly_name<S: Into<String>>(self, friendly_name: S) -> Self { Self { friendly_name: friendly_name.into(), ..self } } pub fn status_text<S: Into<String>>(self, status_text: S) -> Self { Self { status_text: status_text.into(), ..self } } pub fn into_rc(self) -> ChatDataRc { Rc::new(RefCell::new(self)) } } #[derive(PartialEq, Debug)] enum ChatState { Initial, Sync, Active, Terminated, } pub struct ChatChannelSM<UserCallback> { state: ChatState, data: ChatDataRc, timestamp_fn: TimestampFn, user_callback: UserCallback, } impl<UserCallback> ChatChannelSM<UserCallback> where UserCallback: ChatChannelCallbackTrait, { pub fn new(config: ChatDataRc, timestamp_fn: TimestampFn, user_callback: UserCallback) -> Self { Self { state: ChatState::Initial, data: Rc::clone(&config), timestamp_fn, user_callback, } } fn __unexpected_with_call<'msg>(&self) -> VirtChannelSMResult<'msg> { ProtoError::new(ProtoErrorKind::VirtualChannel(self.get_channel_name())).or_desc(format!( "unexpected call to `update_with_chan_msg` in state {:?}", self.state )) } fn __unexpected_without_call<'msg>(&self) -> VirtChannelSMResult<'msg> { ProtoError::new(ProtoErrorKind::VirtualChannel(self.get_channel_name())).or_desc(format!( "unexpected call to `update_without_chan_msg` in state {:?}", self.state )) } fn __unexpected_message<'msg: 'a, 'a>(&self, unexpected: &'a NowVirtualChannel<'msg>) -> VirtChannelSMResult<'msg> { ProtoError::new(ProtoErrorKind::VirtualChannel(self.get_channel_name())).or_desc(format!( "received an unexpected message in state {:?}: {:?}", self.state, unexpected )) } } impl<UserCallback> VirtualChannelSM for ChatChannelSM<UserCallback> where UserCallback: ChatChannelCallbackTrait, { fn get_channel_name(&self) -> ChannelName { ChannelName::Chat } fn is_terminated(&self) -> bool { self.state == ChatState::Terminated } fn waiting_for_packet(&self) -> bool { self.state == ChatState::Active || self.state == ChatState::Sync } fn update_without_chan_msg<'msg>(&mut self) -> VirtChannelSMResult<'msg> { match self.state { ChatState::Initial => { log::trace!("start syncing"); self.state = ChatState::Sync; Ok(Some( NowChatSyncMsg::new( (self.timestamp_fn)(), self.data.borrow().capabilities, NowString65535::from_str(&self.data.borrow().friendly_name)?, ) .status_text(NowString65535::from_str(&self.data.borrow().status_text)?) .into(), )) } _ => self.__unexpected_without_call(), } } fn update_with_chan_msg<'msg: 'a, 'a>( &mut self, chan_msg: &'a NowVirtualChannel<'msg>, ) -> VirtChannelSMResult<'msg> { match chan_msg { NowVirtualChannel::Chat(msg) => match self.state { ChatState::Sync => match msg { NowChatMsg::Sync(msg) => { // update config let mut config_mut = self.data.borrow_mut(); config_mut.capabilities.value &= msg.capabilities.value; config_mut.distant_friendly_name = msg.friendly_name.as_str().to_owned(); config_mut.distant_status_text = msg.status_text.as_str().to_owned(); drop(config_mut); log::trace!("channel synced"); self.state = ChatState::Active; self.user_callback.on_synced() } _ => self.__unexpected_message(chan_msg), }, ChatState::Active => match msg { NowChatMsg::Text(msg) => self.user_callback.on_message(msg), _ => self.__unexpected_message(chan_msg), }, _ => self.__unexpected_with_call(), }, _ => self.__unexpected_message(chan_msg), } } }
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" { #[cfg(feature = "Win32_Foundation")] pub fn RegisterLicenseKeyWithExpiration(licensekey: super::super::Foundation::PWSTR, validityindays: u32, status: *mut LicenseProtectionStatus) -> ::windows_sys::core::HRESULT; #[cfg(feature = "Win32_Foundation")] pub fn ValidateLicenseKeyProtection(licensekey: super::super::Foundation::PWSTR, notvalidbefore: *mut super::super::Foundation::FILETIME, notvalidafter: *mut super::super::Foundation::FILETIME, status: *mut LicenseProtectionStatus) -> ::windows_sys::core::HRESULT; } pub type LicenseProtectionStatus = i32; pub const Success: LicenseProtectionStatus = 0i32; pub const LicenseKeyNotFound: LicenseProtectionStatus = 1i32; pub const LicenseKeyUnprotected: LicenseProtectionStatus = 2i32; pub const LicenseKeyCorrupted: LicenseProtectionStatus = 3i32; pub const LicenseKeyAlreadyExists: LicenseProtectionStatus = 4i32;
use actix_web::{web, App, HttpServer}; use controller; #[actix_web::main] pub async fn run() -> std::io::Result<()> { HttpServer::new(|| { App::new() .service(controller::hello) .service(controller::echo) .route("/hey", web::get().to(controller::manual_hello)) }) .bind("127.0.0.1:8080")? .run() .await }
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { fidl_fuchsia_wlan_service::{ErrCode, ScanRequest, ScanResult, WlanMarker, WlanProxy}, fidl_fuchsia_wlan_tap::WlantapPhyProxy, fuchsia_component::client::connect_to_service, fuchsia_zircon::DurationNum, wlan_common::{bss::Protection, mac::Bssid}, wlan_hw_sim::*, }; const BSS_FOO: Bssid = Bssid([0x62, 0x73, 0x73, 0x66, 0x6f, 0x6f]); const BSS_FOO_2: Bssid = Bssid([0x62, 0x73, 0x73, 0x66, 0x66, 0x66]); const SSID_FOO: &[u8] = b"foo"; const BSS_BAR: Bssid = Bssid([0x62, 0x73, 0x73, 0x62, 0x61, 0x72]); const BSS_BAR_2: Bssid = Bssid([0x63, 0x74, 0x74, 0x63, 0x62, 0x73]); const SSID_BAR: &[u8] = b"bar"; const BSS_BAZ: Bssid = Bssid([0x62, 0x73, 0x73, 0x62, 0x61, 0x7a]); const BSS_BAZ_2: Bssid = Bssid([0x60, 0x70, 0x70, 0x60, 0x60, 0x70]); const SSID_BAZ: &[u8] = b"baz"; async fn scan( wlan_service: &WlanProxy, phy: &WlantapPhyProxy, helper: &mut test_utils::TestHelper, ) -> ScanResult { helper .run_until_complete_or_timeout( 10.seconds(), "receive a scan response", EventHandlerBuilder::new() .on_set_channel( MatchChannel::new() .on_primary( 1, Beacon::send(&phy) .bssid(BSS_FOO) .ssid(SSID_FOO.to_vec()) .protection(Protection::Wpa2Personal) .rssi(-60), ) .on_primary( 2, Beacon::send(&phy) .bssid(BSS_FOO_2) .ssid(SSID_FOO.to_vec()) .protection(Protection::Open) .rssi(-60), ) .on_primary( 6, Beacon::send(&phy) .bssid(BSS_BAR) .ssid(SSID_BAR.to_vec()) .protection(Protection::Wpa2Personal) .rssi(-60), ) .on_primary( 7, Beacon::send(&phy) .bssid(BSS_BAR_2) .ssid(SSID_BAR.to_vec()) .protection(Protection::Wpa2Personal) .rssi(-40), ) .on_primary( 10, Beacon::send(&phy) .bssid(BSS_BAZ) .ssid(SSID_BAZ.to_vec()) .protection(Protection::Open) .rssi(-60), ) .on_primary( 11, Beacon::send(&phy) .bssid(BSS_BAZ_2) .ssid(SSID_BAZ.to_vec()) .protection(Protection::Wpa2Personal) .rssi(-60), ), ) .build(), wlan_service.scan(&mut ScanRequest { timeout: 5 }), ) .await .unwrap() } /// Test scan is working by simulating some fake APs that sends out beacon frames on specific /// channel and verify all beacon frames are correctly reported as valid networks. #[fuchsia_async::run_singlethreaded(test)] async fn simulate_scan() { let mut helper = test_utils::TestHelper::begin_test(default_wlantap_config_client()).await; let wlan_service = connect_to_service::<WlanMarker>().expect("Failed to connect to wlan service"); let () = loop_until_iface_is_found().await; let proxy = helper.proxy(); let scan_result = scan(&wlan_service, &proxy, &mut helper).await; assert_eq!( ErrCode::Ok, scan_result.error.code, "The error message was: {}", scan_result.error.description ); let mut aps: Vec<_> = scan_result .aps .expect("Got empty scan results") .into_iter() .map(|ap| (ap.ssid, ap.bssid, ap.is_secure, ap.rssi_dbm)) .collect(); aps.sort(); let mut expected_aps = [ (String::from_utf8_lossy(SSID_FOO).to_string(), BSS_FOO.0.to_vec(), true, -60), (String::from_utf8_lossy(SSID_BAR).to_string(), BSS_BAR_2.0.to_vec(), true, -40), (String::from_utf8_lossy(SSID_BAZ).to_string(), BSS_BAZ_2.0.to_vec(), true, -60), ]; expected_aps.sort(); assert_eq!(&expected_aps, &aps[..]); }
use std::io::{self, Read}; #[macro_use] extern crate enum_map; use enum_map::EnumMap; #[derive(Copy, Clone, Debug, EnumMap)] pub enum Axis { Nw, N, Ne, } #[derive(Copy, Clone, Debug)] pub enum Direction { Forward, Backward, } #[derive(Copy, Clone, Debug)] pub struct Step { pub axis: Axis, pub direction: Direction, } impl Step { fn parse(v: &str) -> Step { use Axis::*; use Direction::*; match v { "nw" => Step { axis: Nw, direction: Forward }, "n" => Step { axis: N, direction: Forward }, "ne" => Step { axis: Ne, direction: Forward }, "sw" => Step { axis: Ne, direction: Backward }, "s" => Step { axis: N, direction: Backward }, "se" => Step { axis: Nw, direction: Backward }, _ => panic!("unknown step code {}", v), } } } #[derive(Clone, Debug)] pub struct Travel(EnumMap<Axis, i32>); impl Travel { pub fn new() -> Travel { Travel(EnumMap::new()) } pub fn take(&mut self, step: Step) { use Direction::*; self.0[step.axis] += match step.direction { Forward => 1, Backward => -1 }; } pub fn reduce(&mut self) { use Axis::*; self.merge(Nw, Ne, 1, N); self.merge(N, Ne, -1, Nw); self.merge(N, Nw, -1, Ne); } fn merge(&mut self, a1: Axis, a2: Axis, a2_mod: i32, at: Axis) { let v1 = self.0[a1]; let a1_signum = v1.signum(); let v2 = self.0[a2] * a2_mod; if a1_signum == v2.signum() { let vt = v1.abs().min(v2.abs()) * a1_signum; self.0[a1] -= vt; self.0[a2] -= vt * a2_mod; self.0[at] += vt; } } pub fn step_count(&self) -> u32 { self.0.values().fold(0, |sum, v| sum + (v.abs() as u32)) } } fn get_input() -> Travel { let mut buffer = String::new(); io::stdin().read_to_string(&mut buffer).expect("could not read stdin"); let mut result = Travel::new(); for s in buffer.trim().split(',').map(|s| Step::parse(s)) { result.take(s); } result } fn solve(mut data: Travel) -> u32 { data.reduce(); data.step_count() } fn main() { let data = get_input(); let result = solve(data); println!("Solution: {}", result); } #[cfg(test)] mod tests { use super::*; use Axis::*; use Direction::*; #[test] fn counts_trivial_path() { let mut path = Travel::new(); path.take(Step { axis: N, direction: Forward }); path.take(Step { axis: N, direction: Forward }); path.reduce(); assert_eq!(2, path.step_count()); } #[test] fn reduces_opposing_steps() { let mut path = Travel::new(); path.take(Step { axis: N, direction: Forward }); path.take(Step { axis: N, direction: Backward }); path.reduce(); assert_eq!(0, path.step_count()); } #[test] fn reduces_n_sw() { let mut path = Travel::new(); path.take(Step { axis: N, direction: Forward }); path.take(Step { axis: Ne, direction: Backward }); path.reduce(); assert_eq!(1, path.step_count()); } #[test] fn reduces_n_se() { let mut path = Travel::new(); path.take(Step { axis: N, direction: Forward }); path.take(Step { axis: Nw, direction: Backward }); path.reduce(); assert_eq!(1, path.step_count()); } #[test] fn reduces_s_ne() { let mut path = Travel::new(); path.take(Step { axis: N, direction: Backward }); path.take(Step { axis: Nw, direction: Forward }); path.reduce(); assert_eq!(1, path.step_count()); } #[test] fn reduces_ne_nw() { let mut path = Travel::new(); path.take(Step { axis: Nw, direction: Forward }); path.take(Step { axis: Ne, direction: Forward }); path.reduce(); assert_eq!(1, path.step_count()); } #[test] fn reduces_se_sw() { let mut path = Travel::new(); path.take(Step { axis: Nw, direction: Backward }); path.take(Step { axis: Ne, direction: Backward }); path.reduce(); assert_eq!(1, path.step_count()); } }
// The MIT License (MIT) // // Copyright (c) 2013 Jeremy Letang (letang.jeremy@gmail.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limitation the rights to // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of // the Software, and to permit persons to whom the Software is furnished to do so, // subject to the following conditions: // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. //! The portable PortAudio API. use std::{string, ptr, mem}; use std::mem::{transmute}; use std::vec::{Vec}; use std::vec::raw::{from_buf}; use libc::{c_double, c_void, malloc}; use libc::types::os::arch::c95::size_t; use types::*; use ffi; // use user_traits::*; /// Retrieve the release number of the currently running PortAudio build. pub fn get_version() -> i32 { unsafe { ffi::Pa_GetVersion() } } /// Retrieve a textual description of the current PortAudio build. pub fn get_version_text() -> String { unsafe { string::raw::from_buf(ffi::Pa_GetVersionText() as *const u8) } } /** * Translate the supplied PortAudio error code into a human readable message. * * # Arguments * * error_code - The error code * * Return the error as a string. */ pub fn get_error_text(error_code: PaError) -> String { unsafe { string::raw::from_buf(ffi::Pa_GetErrorText(error_code) as *const u8) } } /** * Library initialization function - call this before using PortAudio. * This function initializes internal data structures and prepares underlying * host APIs for use. With the exception of get_version(), get_version_text(), * and get_error_text(), this function MUST be called before using any other * PortAudio API functions. * * Note that if initialize() returns an error code, Pa_Terminate() should NOT be * called. * * Return PaNoError if successful, otherwise an error code indicating the cause * of failure. */ pub fn initialize() -> PaError { unsafe { ffi::Pa_Initialize() } } /** * Library termination function - call this when finished using PortAudio. * This function deallocates all resources allocated by PortAudio since it was * initialized by a call to initialize(). In cases where initialise() has been * called multiple times, each call must be matched with a corresponding call to * terminate(). The final matching call to terminate() will automatically close * any PortAudio streams that are still open. * * terminate() MUST be called before exiting a program which uses PortAudio. * Failure to do so may result in serious resource leaks, such as audio devices * not being available until the next reboot. * * Return PaNoError if successful, otherwise an error code indicating the cause * of failure. */ pub fn terminate() -> PaError { unsafe { ffi::Pa_Terminate() } } /** * Retrieve the number of available host APIs. * Even if a host API is available it may have no devices available. * * Return a non-negative value indicating the number of available host APIs or, * a PaErrorCode (which are always negative) if PortAudio is not initialized or * an error is encountered. */ pub fn get_host_api_count() -> PaHostApiIndex { unsafe { ffi::Pa_GetHostApiCount() } } /** * Retrieve the index of the default host API. * The default host API will be the lowest common denominator host API * on the current platform and is unlikely to provide the best performance. * * Return a non-negative value ranging from 0 to (get_host_api_count()-1) * indicating the default host API index or, a PaErrorCode (which are always * negative) if PortAudio is not initialized or an error is encountered. */ pub fn get_default_host_api() -> PaHostApiIndex { unsafe { ffi::Pa_GetDefaultHostApi() } } /** * Retrieve a pointer to a structure containing information about a specific host * Api. * * # Arguments * * host_api - A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) * * Return Some(PaHostApiInfo) describing a specific host API. If the hostApi * parameter is out of range or an error is encountered, the function returns None. */ pub fn get_host_api_info(host_api: PaHostApiIndex) -> Option<PaHostApiInfo> { let c_host_info = unsafe { ffi::Pa_GetHostApiInfo(host_api) }; if c_host_info.is_null() { None } else { Some(PaHostApiInfo::wrap(c_host_info)) } } /** * Convert a static host API unique identifier, into a runtime host API index. * * # Arguments * * typde_id - A unique host API identifier belonging to the PaHostApiTypeId * enumeration. * * Return a valid PaHostApiIndex ranging from 0 to (get_host_api_count()-1) or, * a PaErrorCode (which are always negative) if PortAudio is not initialized or * an error is encountered. */ pub fn host_api_type_id_to_host_api_index(type_id: PaHostApiTypeId) -> PaHostApiIndex { unsafe { ffi::Pa_HostApiTypeIdToHostApiIndex(type_id as i32) } } /** * Convert a host-API-specific device index to standard PortAudio device index. * This function may be used in conjunction with the deviceCount field of * PaHostApiInfo to enumerate all devices for the specified host API. * * # Arguments * * host_api - A valid host API index ranging from 0 to (get_host_api_count()-1) * * host_api_device_index - A valid per-host device index in the range 0 to * (get_host_api_info(host_api).device_count-1) * * Return a non-negative PaDeviceIndex ranging from 0 to (get_device_count()-1) * or, a PaErrorCode (which are always negative) if PortAudio is not initialized * or an error is encountered. */ pub fn host_api_device_index_to_device_index(host_api: PaHostApiIndex, host_api_device_index: int) -> PaDeviceIndex { unsafe { ffi::Pa_HostApiDeviceIndexToDeviceIndex(host_api, host_api_device_index as i32) } } /** * Return information about the last host error encountered. * The error information returned by get_last_host_error_info() will never be * modified asynchronously by errors occurring in other PortAudio owned threads * (such as the thread that manages the stream callback.) * * This function is provided as a last resort, primarily to enhance debugging * by providing clients with access to all available error information. * * Return a pointer to an immuspacespacespacele structure constraining * information about the host error. The values in this structure will only be * valid if a PortAudio function has previously returned the * PaUnanticipatedHostError error code. */ pub fn get_last_host_error_info() -> PaHostErrorInfo { let c_error = unsafe { ffi::Pa_GetLastHostErrorInfo() }; PaHostErrorInfo::wrap(c_error) } /** * Retrieve the number of available devices. The number of available devices may * be zero. * * Return A non-negative value indicating the number of available devices or, * a PaErrorCode (which are always negative) if PortAudio is not initialized or * an error is encountered. */ pub fn get_device_count() -> PaDeviceIndex { unsafe { ffi::Pa_GetDeviceCount() } } /** * Retrieve the index of the default input device. * The result can be used in the inputDevice parameter to open_stream(). * * Return the default input device index for the default host API, or PaNoDevice * if no default input device is available or an error was encountered */ pub fn get_default_input_device() -> PaDeviceIndex { unsafe { ffi::Pa_GetDefaultInputDevice() } } /** * Retrieve the index of the default output device. The result can be * used in the outputDevice parameter to open_stream(). * * Return the default output device index for the default host API, or PaNoDevice * if no default output device is available or an error was encountered. */ pub fn get_default_output_device() -> PaDeviceIndex { unsafe { ffi::Pa_GetDefaultOutputDevice() } } /** * Retrieve a pointer to a PaDeviceInfo structure containing information about * the specified device. * * # Arguments * * device - A valid device index in the range 0 to (Pa_GetDeviceCount()-1) * * Return Some(PaDeviceInfo) or, If the device parameter is out of range the * function returns None. */ pub fn get_device_info(device: PaDeviceIndex) -> Option<PaDeviceInfo> { let c_info = unsafe { ffi::Pa_GetDeviceInfo(device) }; if c_info.is_null() { None } else { Some(PaDeviceInfo::wrap(c_info)) } } /** * Determine whether it would be possible to open a stream with the specified * parameters. * * # Arguments * * input_parameters - A structure that describes the input parameters used to * open a stream. * The suggestedLatency field is ignored. See PaStreamParameters for a * description of these parameters. inputParameters must be None for output-only * streams. * * output_parameters - A structure that describes the output parameters used to * open a stream. The suggestedLatency field is ignored. See PaStreamParameters * for a description of these parameters. outputParameters must be None for * input-only streams. * * sample_rate - The required sampleRate. For full-duplex streams it is the * sample rate for both input and output. * * Return 0 if the format is supported, and an error code indicating why the * format is not supported otherwise. The constant PaFormatIsSupported is * provided to compare with the return value for success. */ pub fn is_format_supported(input_parameters: &PaStreamParameters, output_parameters: &PaStreamParameters, sample_rate : f64) -> PaError { let c_input = input_parameters.unwrap(); let c_output = output_parameters.unwrap(); unsafe { ffi::Pa_IsFormatSupported(&c_input, &c_output, sample_rate as c_double) } } /** * Retrieve the size of a given sample format in bytes. * * Return the size in bytes of a single sample in the specified format, * or PaSampleFormatNotSupported if the format is not supported. */ pub fn get_sample_size(format: PaSampleFormat) -> PaError { unsafe { ffi::Pa_GetSampleSize(format as u64) } } /** * Put the caller to sleep for at least 'msec' milliseconds. * This function is provided only as a convenience for authors of portable code * (such as the tests and examples in the PortAudio distribution.) * * The function may sleep longer than requested so don't rely on this for * accurate musical timing. */ pub fn sleep(m_sec : int) -> () { unsafe { ffi::Pa_Sleep(m_sec as i32) } } // #[doc(hidden)] // pub struct WrapObj { // pa_callback : @PortaudioCallback // } /// Representation of an audio stream, where the format of the stream is defined /// by the S parameter. pub struct PaStream<S> { c_pa_stream : *mut ffi::C_PaStream, sample_format : PaSampleFormat, c_input : Option<ffi::C_PaStreamParameters>, c_output : Option<ffi::C_PaStreamParameters>, unsafe_buffer : *mut c_void, callback_function : Option<PaCallbackFunction>, num_input_channels : i32 } impl<S> PaStream<S> { /** * Constructor for PaStream. * * Return a new PaStream. */ pub fn new(sample_format: PaSampleFormat) -> PaStream<S> { PaStream { c_pa_stream : ptr::null_mut(), sample_format : sample_format, c_input : None, c_output : None, unsafe_buffer : ptr::null_mut(), callback_function : None, num_input_channels : 0 } } /** * Opens a stream for either input, output or both. * * # Arguments * * input_parameters - A structure that describes the input parameters used * by the opened stream. * * output_parameters - A structure that describes the output parameters * used by the opened stream. * * sample_rate - The desired sample_rate. For full-duplex streams it is the * sample rate for both input and output * * frames_per_buffer - The number of frames passed to the stream callback * function. * * stream_flags -Flags which modify the behavior of the streaming process. * This parameter may contain a combination of flags ORed together. Some * flags may only be relevant to certain buffer formats. * * Upon success returns PaNoError and the stream is inactive (stopped). * If fails, a non-zero error code is returned. */ pub fn open(&mut self, input_parameters: Option<&PaStreamParameters>, output_parameters: Option<&PaStreamParameters>, sample_rate: f64, frames_per_buffer: u32, stream_flags: PaStreamFlags) -> PaError { if !input_parameters.is_none() { self.c_input = Some(input_parameters.unwrap().unwrap()); self.num_input_channels = input_parameters.unwrap().channel_count; self.unsafe_buffer = unsafe { malloc(mem::size_of::<S>() as size_t * frames_per_buffer as size_t * input_parameters.unwrap().channel_count as size_t) as *mut c_void}; } if !output_parameters.is_none() { self.c_output = Some(output_parameters.unwrap().unwrap()); } unsafe { if !self.c_input.is_none() && !self.c_output.is_none() { ffi::Pa_OpenStream(&mut self.c_pa_stream, &(self.c_input.unwrap()), &(self.c_output.unwrap()), sample_rate as c_double, frames_per_buffer, stream_flags as u64, None, ptr::null_mut()) } else if !self.c_input.is_none() { ffi::Pa_OpenStream(&mut self.c_pa_stream, &(self.c_input.unwrap()), ptr::null(), sample_rate as c_double, frames_per_buffer, stream_flags as u64, None, ptr::null_mut()) } else if !self.c_output.is_none() { ffi::Pa_OpenStream(&mut self.c_pa_stream, ptr::null(), &(self.c_output.unwrap()), sample_rate as c_double, frames_per_buffer, stream_flags as u64, None, ptr::null_mut()) } else { PaBadStreamPtr } } } /** * A simplified version of open() that opens the default input and/or output * devices. * * # Arguments * * sample_rate - The desired sample_rate. For full-duplex streams it is * the sample rate for both input and output * * frames_per_buffer - The number of frames passed to the stream callback * function * * num_input_channels - The number of channels of sound that will be * supplied to the stream callback or returned by Pa_ReadStream. It can range * from 1 to the value of maxInputChannels in the PaDeviceInfo record for the * default input device. If 0 the stream is opened as an output-only stream. * * num_output_channels - The number of channels of sound to be delivered to * the stream callback or passed to Pa_WriteStream. It can range from 1 to * the value of maxOutputChannels in the PaDeviceInfo record for the default * output device. If 0 the stream is opened as an output-only stream. * * sample_format - The sample_format for the input and output buffers. * * Upon success returns PaNoError and the stream is inactive (stopped). * If fails, a non-zero error code is returned. */ pub fn open_default(&mut self, sample_rate: f64, frames_per_buffer: u32, num_input_channels: i32, num_output_channels: i32, sample_format: PaSampleFormat) -> PaError { if num_input_channels > 0 { self.c_input = None; self.num_input_channels = num_input_channels; self.unsafe_buffer = unsafe { malloc(mem::size_of::<S>() as size_t * frames_per_buffer as size_t * num_input_channels as size_t) as *mut c_void }; } unsafe { ffi::Pa_OpenDefaultStream(&mut self.c_pa_stream, num_input_channels, num_output_channels, sample_format as u64, sample_rate as c_double, frames_per_buffer, None, ptr::null_mut()) } } /// Closes an audio stream. If the audio stream is active it discards any /// pending buffers as if abort_tream() had been called. pub fn close(&mut self) -> PaError { unsafe { ffi::Pa_CloseStream(self.c_pa_stream) } } /// Commences audio processing. pub fn start(&mut self) -> PaError { unsafe { ffi::Pa_StartStream(self.c_pa_stream) } } /// Terminates audio processing. It waits until all pending audio buffers /// have been played before it returns. pub fn stop(&mut self) -> PaError { unsafe { ffi::Pa_StopStream(self.c_pa_stream) } } /// Terminates audio processing immediately without waiting for pending /// buffers to complete. pub fn abort(&mut self) -> PaError { unsafe { ffi::Pa_AbortStream(self.c_pa_stream) } } /** * Determine whether the stream is stopped. * A stream is considered to be stopped prior to a successful call to * start_stream and after a successful call to stop_stream or abort_stream. * If a stream callback returns a value other than PaContinue the stream is * NOT considered to be stopped. * * Return one (1) when the stream is stopped, zero (0) when the stream is * running or, a PaErrorCode (which are always negative) if PortAudio is not * initialized or an error is encountered. */ pub fn is_stopped(&self) -> PaError { unsafe { ffi::Pa_IsStreamStopped(self.c_pa_stream) } } /** * Determine whether the stream is active. A stream is active after a * successful call to start_stream(), until it becomes inactive either as a * result of a call to stop_stream() or abort_stream(), or as a result of a * return value other than paContinue from the stream callback. In the latter * case, the stream is considered inactive after the last buffer has finished * playing. * * Return Ok(true) when the stream is active (ie playing or recording audio), * Ok(false) when not playing or, a Err(PaError) if PortAudio is not * initialized or an error is encountered. */ pub fn is_active(&self) -> Result<bool, PaError> { let err = unsafe { ffi::Pa_IsStreamActive(self.c_pa_stream) }; match err { 0 => Ok(false), 1 => Ok(true), _ => Err(unsafe { transmute::<i32, PaError>(err) }) } } /** * Returns the current time in seconds for a stream according to the same * clock used to generate callback PaStreamCallbackTimeInfo timestamps. * The time values are monotonically increasing and have unspecified origin. * * get_stream_time returns valid time values for the entire life of the * stream, from when the stream is opened until it is closed. * Starting and stopping the stream does not affect the passage of time * returned by Pa_GetStreamTime. * * Return the stream's current time in seconds, or 0 if an error occurred. */ pub fn get_stream_time(&self) -> PaTime { unsafe { ffi::Pa_GetStreamTime(self.c_pa_stream) } } /** * Retrieve CPU usage information for the specified stream. * * The "CPU Load" is a fraction of total CPU time consumed by a callback * stream's audio processing routines including, but not limited to the * client supplied stream callback. This function does not work with blocking * read/write streams. */ pub fn get_stream_cpu_load(&self) -> f64 { unsafe { ffi::Pa_GetStreamCpuLoad(self.c_pa_stream) } } /** * Retrieve the number of frames that can be read from the stream without * waiting. * * Returns a non-negative value representing the maximum number of frames * that can be read from the stream without blocking or busy waiting or, * a PaErrorCode (which are always negative) if PortAudio is not initialized * or an error is encountered. */ pub fn get_stream_read_available(&self) -> i64 { unsafe { ffi::Pa_GetStreamReadAvailable(self.c_pa_stream) } } /** * Retrieve the number of frames that can be written to the stream without * waiting. * * Return a non-negative value representing the maximum number of frames that * can be written to the stream without blocking or busy waiting or, * a PaErrorCode (which are always negative) if PortAudio is not initialized * or an error is encountered. */ pub fn get_stream_write_available(&self) -> i64 { unsafe { ffi::Pa_GetStreamWriteAvailable(self.c_pa_stream) } } #[doc(hidden)] // Temporary OSX Fixe : Return always PaInputOverflowed #[cfg(target_os="macos")] pub fn read(&self, frames_per_buffer: u32) -> Result<Vec<S>, PaError> { unsafe { ffi::Pa_ReadStream(self.c_pa_stream, self.unsafe_buffer, frames_per_buffer) }; Ok(unsafe { from_buf(self.unsafe_buffer as *const S, (frames_per_buffer * self.num_input_channels as u32) as uint) }) } /** * Read samples from an input stream. * The function doesn't return until the entire buffer has been filled - this * may involve waiting for the operating system to supply the data. * * # Arguments * * frames_per_buffer - The number of frames in the buffer. * * Return Ok(~[S]), a buffer containing the sample of the format S. * If fail return a PaError code. */ #[cfg(any(target_os="win32", target_os="linux"))] pub fn read(&self, frames_per_buffer: u32) -> Result<Vec<S>, PaError> { let err = unsafe { ffi::Pa_ReadStream(self.c_pa_stream, self.unsafe_buffer, frames_per_buffer) }; match err { PaNoError => Ok(unsafe { from_buf(self.unsafe_buffer as *const S, (frames_per_buffer * self.num_input_channels as u32) as uint) }), _ => Err(err) } } /** * Write samples to an output stream. * This function doesn't return until the entire buffer has been consumed * - this may involve waiting for the operating system to consume the data. * * # Arguments * * output_buffer - The buffer contains samples in the format specified by S. * * frames_per_buffer - The number of frames in the buffer. * * Return PaNoError on success, or a PaError code if fail. */ pub fn write(&self, output_buffer: Vec<S>, frames_per_buffer : u32) -> PaError { unsafe { ffi::Pa_WriteStream(self.c_pa_stream, output_buffer.as_ptr() as *mut c_void, frames_per_buffer) } } /// Retrieve a PaStreamInfo structure containing information about the /// specified stream. pub fn get_stream_info(&self) -> PaStreamInfo { unsafe { *ffi::Pa_GetStreamInfo(self.c_pa_stream) } } #[doc(hidden)] pub fn get_c_pa_stream(&self) -> *mut ffi::C_PaStream { self.c_pa_stream } }
use std::ops::Index; /// Represents a token in a material source file. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum Token { /* Keywords */ Program, Property, /* Operator symbols */ Eq, /* Structural symbols */ Colon, SemiColon, OpenCurly, CloseCurly, /* Literal */ ProgramLiteral, /* Name components */ Identifier, /* Other */ EndOfFile, } /// Represents a span covering a chunk of source material. /// /// Used to reconstruct line numbers for errors. The indices are the byte indices in the source /// document. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct Span { pub begin: usize, pub end: usize, } impl Span { pub const fn new(begin: usize, end: usize) -> Span { Span { begin: begin, end: end, } } } impl Index<Span> for str { type Output = str; fn index(&self, index: Span) -> &str { &self[index.begin..index.end] } }
#![deny(warnings)] #![no_std] #[macro_use] extern crate bounded_registers; #[macro_use] extern crate typenum; pub mod ccu; pub mod de; pub mod de_mixer; pub mod dma; pub mod hdmi; pub mod hstimer; pub mod pio; pub mod sysc; pub mod tcon0; pub mod tcon1; pub mod timer; pub mod uart0; pub mod uart1; pub mod uart2; pub mod uart3; pub mod uart4; pub mod uart_common;
//! # Jplaceholder //! [![Build Status](https://travis-ci.com/WebD-EG/Jplaceholder-Rust.svg?token=2xwgxyVwYTZY33ZwbM8M&branch=master)](https://travis-ci.com/WebD-EG/Jplaceholder-Rust) //! A Rust library for the JSON Placeholder API //! Documentation: [https://docs.rs/jplaceholder/1.0.1/jplaceholder/](https://docs.rs/jplaceholder/1.0.1/jplaceholder/) //! # Table of Contents //! - [JPlaceholder](#jplaceholder) //! - [Example](#example) //! - [Installation](#installation) //! - [Usage](#usage) //! - [The model trait](#the-model-trait) //! - [Relationships](#relationships) //! - [Contribution guide](#contribution-guide) //! ## Example: //! ```rust //! extern crate jplaceholder; //! use jplaceholder::Model; //! use jplaceholder::Post; //! match Post::find(2) { //! Some(post) => println!("Title of the article {}: {}", post.id, post.title), //! None => println!("Article not found!") //! } //! ``` //! ## Installation //! To install the library, you just have to put it into your **Cargo.toml** file: //! ```toml //! jplaceholder = "1.0.1" //! ``` //! Then, require the library into your main file. //! ```rust //! extern crate jplaceholder; //! ``` extern crate reqwest; extern crate serde_json; extern crate serde; #[macro_use] extern crate serde_derive; pub mod post; pub mod model; pub mod user; mod utils; pub use post::Post; pub use model::Model; pub use user::User;
#[cfg(test)] mod tests { use std::collections::HashSet; use std::fs::File; use std::io::{BufReader, Lines}; use std::str::FromStr; use crate::reader::get_lines; use crate::grid::{Grid, Point}; #[test] fn test_part1() { let input = get_lines("./resources/inputs/day9-input.txt"); let grid = parse_to_grid(input); //grid.print_grid(); let low_values = get_low_values(grid); let answer: u64 = low_values.iter().sum::<u64>() + low_values.len() as u64; assert_eq!(607, answer) } #[test] fn test_part2_example() { let input = get_lines("./resources/inputs/day9-example.txt"); let grid = parse_to_grid(input); //grid.print_grid(); let basins = get_basins(grid); let answer = get_answer(basins); assert_eq!(1134, answer) } #[test] fn test_part2_input() { let input = get_lines("./resources/inputs/day9-input.txt"); let grid = parse_to_grid(input); //grid.print_grid(); let basins = get_basins(grid); let answer = get_answer(basins); assert_eq!(900864, answer) } fn get_answer(basins: Vec<Vec<Point>>) -> usize { let mut basin_sizes: Vec<usize> = basins.iter().map(|basin| basin.len()).collect(); basin_sizes.sort(); basin_sizes.reverse(); //println!("{:?}", basin_sizes); let answer: usize = basin_sizes.iter().take(3).product(); answer } fn get_low_values(grid: Grid) -> Vec<u64> { let mut low_values: Vec<u64> = Vec::new(); for (position, value) in grid.get_map() { let neighbours = grid.get_neighbours(position); let amount_low = neighbours.iter().map(|position| grid.get_map().get(position).unwrap()).filter(|n_value| n_value <= &value).count(); if amount_low == 0 { low_values.push(*value) } } //println!("{:?}", low_values); low_values } fn get_low_positions(grid: &Grid) -> Vec<Point> { let mut low_points: Vec<Point> = Vec::new(); for (position, value) in grid.get_map() { let neighbours = grid.get_neighbours(position); let amount_low = neighbours.iter().map(|position| grid.get_map().get(position).unwrap()).filter(|n_value| n_value <= &value).count(); if amount_low == 0 { low_points.push(position.clone()) } } //println!("{:?}", low_points); low_points } fn get_basins(grid: Grid) -> Vec<Vec<Point>> { // every low point is the start of the basin // from there add neighbours untill you reach a 9. let mut basins = Vec::new(); let positions = get_low_positions(&grid); // while discovered neighbours is not 9 or known pos search deeper for low_point in positions { let mut basin = Vec::new(); let mut search_positions = vec![low_point.clone()]; loop { let mut new_sites = HashSet::new(); for position in &search_positions { let neighbours = grid.get_neighbours(&position); for neighbour in neighbours { if grid.get_map().get(&neighbour).unwrap() != &9 && !basin.contains(&neighbour) { new_sites.insert(neighbour); } } } basin.append(&mut search_positions); // end of basin reached if new_sites.is_empty() { basins.push(basin); break // everything discovered is new front } else { search_positions = new_sites.iter().map(|x| x.clone()).collect(); } } } basins } fn parse_to_grid(input: Lines<BufReader<File>>) -> Grid { let mut grid = Grid::new(); for (y, line) in input.enumerate() { let line = line.unwrap(); //println!("{:?}", line.clone().trim().chars().collect::<Vec<char>>()); for (x, nr) in line.trim().chars().map(|s| u64::from_str(&*s.to_string()).unwrap()).enumerate() { grid.add_to_grid(Point::new(x as isize, y as isize), nr); } } grid } }
use base_x; use diesel::debug_query; use diesel::prelude::*; use failure::{Fallible, ResultExt}; use std::{cmp, str}; use uuid::Uuid; use crate::db::{self, model::*, schema::*, Paginate}; pub struct PadsDao { pool: db::DBPool, } impl PadsDao { pub fn new(pool: &db::DBPool) -> Self { Self { pool: pool.clone() } } pub fn query_all( &self, user_id: i32, pagination: &Pagination, filters: &PadFilter, ) -> Fallible<PaginatedData<Pad>> { let conn = db::get_connection(&self.pool)?; let page_size = cmp::max(1, cmp::min(pagination.page_size, 25)); let mut query = pads::table.into_boxed(); query = query.filter(pads::user_id.eq(user_id)); if let Some(days) = filters.days.as_ref() { let days_value: i32 = days.parse().unwrap_or(0); if days_value > 0 { use diesel::dsl::*; query = query.filter(pads::created_at.ge(now - days_value.days())); } } if let Some(status) = filters.status.as_ref() { if status.len() > 0 { query = query.filter(pads::status.eq(status)); } } if let Some(search) = filters.search.as_ref() { if search.len() > 0 && !search.contains("%") && !search.contains("?") { let title_pat = format!("%{}%", search); let creator_pat = title_pat.clone(); let criteria = pads::title .like(title_pat) .or(pads::creator.like(creator_pat)); query = query.filter(criteria); } } let query = query .select(pads::all_columns) .order(pads::created_at.desc()) .paginate(pagination.page_index as i64) .page_size(page_size as i64); debug!( "query_all_pads = {}", debug_query::<db::DB, _>(&query).to_string() ); let (data, total) = query .load_and_count::<db::Pad>(&conn) .context("query_all_pads_failure")?; Ok(PaginatedData { page_index: pagination.page_index, page_size: page_size, total: total as i32, data: data, }) } pub fn query_pad_count(&self, user_id: i32) -> Fallible<i32> { let conn = db::get_connection(&self.pool)?; let pads_count: i64 = pads::table .filter(pads::user_id.eq(user_id)) .count() .get_result(&conn) .context("query_pads_count_failure")?; Ok(pads_count as i32) } pub fn create_pad( &self, user_id: i32, title: Option<String>, language: Option<String>, ) -> Fallible<Pad> { let conn = db::get_connection(&self.pool)?; let hash = Self::generate_pad_hash(); let hash_title: String = hash.chars().take(6).collect(); let title_str = title.unwrap_or(format!("untitled - {}", hash_title)); let language_str = language.unwrap_or("plaintext".into()); let status = PadStatus::Unused; let new_pad = NewPad { hash: hash, user_id: user_id, title: title_str.into(), status: status.as_str().into(), creator: "".into(), language: language_str.into(), }; let pad = diesel::insert_into(pads::table) .values(new_pad) .get_result(&conn) .context("create_pad_failure")?; Ok(pad) } fn generate_pad_hash() -> String { let hash_uuid = Uuid::new_v4(); let data = base_x::encode(BASE62_ALPHABETS, hash_uuid.as_bytes()); data } } const BASE62_ALPHABETS: &'static str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; const PAD_STATUS_UNUSED: &'static str = "unused"; const PAD_STATUS_PROCESSING: &'static str = "processing"; const PAD_STATUS_ENDED: &'static str = "ended"; pub enum PadStatus { Unused, Processing, Ended, } impl str::FromStr for PadStatus { type Err = &'static str; fn from_str(s: &str) -> Result<Self, Self::Err> { match s { PAD_STATUS_UNUSED => Ok(PadStatus::Unused), PAD_STATUS_PROCESSING => Ok(PadStatus::Processing), PAD_STATUS_ENDED => Ok(PadStatus::Ended), _ => Err("unknown status"), } } } impl PadStatus { pub fn as_str(&self) -> &'static str { match self { PadStatus::Unused => PAD_STATUS_UNUSED, PadStatus::Processing => PAD_STATUS_PROCESSING, PadStatus::Ended => PAD_STATUS_ENDED, } } } // pad contents impl PadsDao { pub fn query_pad_by_hash(&self, pad_hash: &str) -> Fallible<Option<Pad>> { let conn = db::get_connection(&self.pool)?; let pad = pads::table .filter(pads::hash.eq(pad_hash)) .first::<Pad>(&conn) .optional()?; Ok(pad) } pub fn query_pad_content(&self, pad_id: i32) -> Fallible<Option<PadContent>> { let conn = db::get_connection(&self.pool)?; let content = pad_contents::table .find(pad_id) .first::<PadContent>(&conn) .optional()?; Ok(content) } pub fn save_pad_content(&self, content: NewPadContent) -> Fallible<()> { let conn = db::get_connection(&self.pool)?; let code = &content.code; diesel::insert_into(pad_contents::table) .values(&content) .on_conflict(pad_contents::pad_id) .do_update() .set(pad_contents::code.eq(code)) .execute(&conn)?; Ok(()) } pub fn update_pad(&self, pad_id: i32, changeset: PadChangeset) -> Fallible<()> { let conn = db::get_connection(&self.pool)?; diesel::update(pads::table) .filter(pads::id.eq(pad_id)) .set(changeset) .execute(&conn)?; Ok(()) } }
use crate::Register; /// Represents whether a pin is an input or an output. pub enum DataDirection { /// The pin is exclusively used for reading signals. Input, /// The pin is exclusively used for sending signals. Output, } /// An IO pin. pub trait Pin { /// The associated data direction register. type DDR: Register<T=u8>; /// The associated port register. type PORT: Register<T=u8>; /// /// Reads from the register will read input bits. /// Writes to the register will toggle bits. type PIN: Register<T=u8>; /// The mask of the pin used for accessing registers. const MASK: u8; /// Sets the data direction of the pin. #[inline(always)] fn set_direction(direction: DataDirection) { match direction { DataDirection::Input => Self::set_input(), DataDirection::Output => Self::set_output(), } } /// Sets the pin up as an input. #[inline(always)] fn set_input() { Self::DDR::unset_mask_raw(Self::MASK); } /// Sets the pin up as an output. #[inline(always)] fn set_output() { Self::DDR::set_mask_raw(Self::MASK); } /// Set the pin to high. /// /// The pin must be configured as an output. #[inline(always)] fn set_high() { Self::PORT::set_mask_raw(Self::MASK); } /// Set the pin to low. /// /// The pin must be configured as an output. #[inline(always)] fn set_low() { Self::PORT::unset_mask_raw(Self::MASK); } /// Toggles the pin. /// /// The pin must be configured as an output. #[inline(always)] fn toggle() { // FIXME: We can optimise this on post-2006 AVRs. // http://www.avrfreaks.net/forum/toggle-state-output-pin // set(Self::PIN, Self::MASK); Self::PORT::toggle_raw(Self::MASK); } /// Check if the pin is currently high. /// /// The pin must be configured as an input. #[inline(always)] fn is_high() -> bool { Self::PIN::is_mask_set_raw(Self::MASK) } /// Checks if the pin is currently low. /// /// The pin must be configured as an input. #[inline(always)] fn is_low() -> bool { Self::PIN::is_clear_raw(Self::MASK) } }
// This is cut-and-pasted from the example in the docs of src/lib.rs. fn main() { use cam_geom::*; use nalgebra::{Matrix2x3, Unit, Vector3}; // Create two points in the world coordinate frame. let world_coords = Points::new(Matrix2x3::new( 1.0, 0.0, 0.0, // point 1 0.0, 1.0, 0.0, // point 2 )); // perepective parameters - focal length of 100, no skew, pixel center at (640,480) let intrinsics = IntrinsicParametersPerspective::from(PerspectiveParams { fx: 100.0, fy: 100.0, skew: 0.0, cx: 640.0, cy: 480.0, }); // Set extrinsic parameters - camera at (10,0,0), looing at (0,0,0), up (0,0,1) let camcenter = Vector3::new(10.0, 0.0, 0.0); let lookat = Vector3::new(0.0, 0.0, 0.0); let up = Unit::new_normalize(Vector3::new(0.0, 0.0, 1.0)); let pose = ExtrinsicParameters::from_view(&camcenter, &lookat, &up); // Create a `Camera` with both intrinsic and extrinsic parameters. let camera = Camera::new(intrinsics, pose); // Project the original 3D coordinates to 2D pixel coordinates. let pixel_coords = camera.world_to_pixel(&world_coords); // Print the results. for i in 0..world_coords.data.nrows() { let wc = world_coords.data.row(i); let pix = pixel_coords.data.row(i); println!("{} -> {}", wc, pix); } }
use crate::Result; use serde::{Deserialize, Serialize}; #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] pub(crate) struct Response { pub filter: Filter, } #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] pub(crate) struct ResponseList { pub filters: Vec<Filter>, } /// An image filter. #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Filter { pub description: String, pub hidden_complex: Option<String>, pub hidden_tag_ids: Vec<i64>, pub id: i64, pub name: String, pub public: bool, pub spoilered_complex: ::serde_json::Value, pub spoilered_tag_ids: Vec<i64>, pub system: bool, pub user_count: i64, pub user_id: ::serde_json::Value, } impl crate::Client { /// Fetch a filter by its ID. pub async fn filter(&self, id: u64) -> Result<Filter> { let resp: Response = self .request(reqwest::Method::GET, &format!("api/v1/json/filters/{}", id)) .send() .await? .error_for_status()? .json() .await?; Ok(resp.filter) } /// Fetch the list of system filters. pub async fn system_filters(&self) -> Result<Vec<Filter>> { let resp: ResponseList = self .request(reqwest::Method::GET, "api/v1/json/filters/system") .send() .await? .error_for_status()? .json() .await?; Ok(resp.filters) } /// Fetch the list of user-level filters. pub async fn user_filters(&self, page: u64) -> Result<Vec<Filter>> { let mut req = self.request(reqwest::Method::GET, "api/v1/json/filters/user"); if page != 0 { req = req.query(&[("page", format!("{}", page))]) } let resp: ResponseList = req.send().await?.error_for_status()?.json().await?; Ok(resp.filters) } } #[cfg(test)] mod tests { use httptest::{matchers::*, responders::*, Expectation, Server}; #[tokio::test] async fn filter() { let _ = pretty_env_logger::try_init(); let data: serde_json::Value = serde_json::from_slice(include_bytes!("../testdata/filter_1.json")).unwrap(); let server = Server::run(); server.expect( Expectation::matching(request::method_path("GET", "/api/v1/json/filters/1")) .respond_with(json_encoded(data)), ); let cli = crate::Client::with_baseurl("test", "42069", &format!("{}", server.url("/"))).unwrap(); cli.filter(1).await.unwrap(); } #[tokio::test] async fn system_filters() { let _ = pretty_env_logger::try_init(); let data: serde_json::Value = serde_json::from_slice(include_bytes!("../testdata/filters_system.json")).unwrap(); let server = Server::run(); server.expect( Expectation::matching(request::method_path("GET", "/api/v1/json/filters/system")) .respond_with(json_encoded(data)), ); let cli = crate::Client::with_baseurl("test", "42069", &format!("{}", server.url("/"))).unwrap(); cli.system_filters().await.unwrap(); } #[tokio::test] async fn user_filters() { let _ = pretty_env_logger::try_init(); let data: serde_json::Value = serde_json::from_slice(include_bytes!("../testdata/filters_system.json")).unwrap(); let server = Server::run(); server.expect( Expectation::matching(request::method_path("GET", "/api/v1/json/filters/user")) .respond_with(json_encoded(data)), ); let cli = crate::Client::with_baseurl("test", "42069", &format!("{}", server.url("/"))).unwrap(); cli.user_filters(0).await.unwrap(); } }
#[cfg(feature = "sgx")] use std::prelude::v1::*; use atomic::{Atomic, Ordering}; use crate::io::IoUringProvider; use crate::poll::{Events, Pollee}; // The common part of the socket's sender and receiver. pub struct Common<P: IoUringProvider> { fd: i32, pollee: Pollee, error: Atomic<Option<i32>>, phantom_data: std::marker::PhantomData<P>, } impl<P: IoUringProvider> Common<P> { pub fn new() -> Self { #[cfg(not(feature = "sgx"))] let fd = unsafe { libc::socket(libc::AF_INET, libc::SOCK_STREAM, 0) }; #[cfg(feature = "sgx")] let fd = unsafe { libc::ocall::socket(libc::AF_INET, libc::SOCK_STREAM, 0) }; assert!(fd >= 0); let pollee = Pollee::new(Events::empty()); let error = Atomic::new(None); Self { fd, pollee, error, phantom_data: std::marker::PhantomData, } } pub fn new_with_fd(fd: i32) -> Self { assert!(fd >= 0); let pollee = Pollee::new(Events::empty()); let error = Atomic::new(None); Self { fd, pollee, error, phantom_data: std::marker::PhantomData, } } pub fn error(&self) -> Option<i32> { self.error.load(Ordering::Acquire) } /// Set error. /// /// The value must be negative. pub fn set_error(&self, error: i32) { debug_assert!(error < 0); self.error.store(Some(error), Ordering::Release); } pub fn io_uring(&self) -> P::Instance { P::get_instance() } pub fn fd(&self) -> i32 { self.fd } pub fn pollee(&self) -> &Pollee { &self.pollee } } impl<P: IoUringProvider> Drop for Common<P> { fn drop(&mut self) { unsafe { #[cfg(not(feature = "sgx"))] libc::close(self.fd); #[cfg(feature = "sgx")] libc::ocall::close(self.fd); } } }
use crate::ray::Ray; mod aabb; mod bvh; mod hit_record; mod hittable_list; mod sphere; pub use aabb::AABB; pub use bvh::BVH; pub use hit_record::HitRecord; pub use hittable_list::HittableList; pub use sphere::Sphere; pub trait Hittable: Send + Sync { fn hit(&self, ray: &Ray, t_min: f64, t_max: f64, rec: &mut HitRecord) -> bool; fn bounding_box(&self, output_box: &mut AABB) -> bool; }
pub use VkPipelineColorBlendStateCreateFlags::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VkPipelineColorBlendStateCreateFlags { VK_PIPELINE_COLOR_BLEND_STATE_CREATE_NULL_BIT = 0, } use crate::SetupVkFlags; #[repr(C)] #[derive(Clone, Copy, Eq, PartialEq, Hash)] pub struct VkPipelineColorBlendStateCreateFlagBits(u32); SetupVkFlags!( VkPipelineColorBlendStateCreateFlags, VkPipelineColorBlendStateCreateFlagBits );
extern crate tictactoe; use tictactoe::board::{Board, GameOutcome}; use tictactoe::player::Player; #[test] fn win() { let mut board = Board::new(); board.play_x(6).unwrap(); board.play_o().unwrap(); board.play_x(7).unwrap(); board.play_o().unwrap(); let outcome = board.play_x(8).unwrap().unwrap(); assert_eq!(outcome, GameOutcome::Winner(Player::X)); } #[test] fn lose() { let mut board = Board::new(); board.play_x(3).unwrap(); board.play_o().unwrap(); board.play_x(4).unwrap(); board.play_o().unwrap(); board.play_x(6).unwrap(); let outcome = board.play_o().unwrap().unwrap(); assert_eq!(outcome, GameOutcome::Winner(Player::O)); } #[test] fn draw() { let mut board = Board::new(); board.play_x(4).unwrap(); board.play_o().unwrap(); board.play_x(3).unwrap(); board.play_o().unwrap(); board.play_x(2).unwrap(); board.play_o().unwrap(); board.play_x(7).unwrap(); board.play_o().unwrap(); let outcome = board.play_x(8).unwrap().unwrap(); assert_eq!(outcome, GameOutcome::Draw); }
use num::traits::PrimInt; use std::cmp::max; use unicode_segmentation::UnicodeSegmentation; pub fn largest_palindrome(digits: u32) -> u32 { let lower = 10.pow(digits - 1); let upper = 10.pow(digits); let range = lower..upper; range.fold(0, |largest, x| { match (lower..x + 1).rev().find(|y| is_palindrome(x * y)) { Some(y) => max(largest, x * y), None => largest } }) } fn is_palindrome(n: u32) -> bool { n.to_string() == UnicodeSegmentation::graphemes(&n.to_string()[..], true) .rev().collect::<String>() }
use structopt::StructOpt; use super::{CliCommand, GlobalFlags}; pub const AFTER_HELP: &str = r#"EXAMPLES: To install the latest version of a package: $ deck install firefox To install a specific version of a package: $ deck install firefox:67.0.0-alpha1 To install multiple packages: $ deck install firefox emacs:25.1.0 ffmpeg This command is a convenient shorthand for `deck profile -i <PACKAGE>`. Any package transaction can be atomically rolled back `deck revert`. See `deck revert --help` for more details. "#; #[derive(Debug, StructOpt)] pub struct Install { /// Profile to apply the transaction #[structopt( short = "p", long = "profile", empty_values = false, value_name = "PROFILE_NAME" )] profile: Option<String>, /// Package manifest specifiers #[structopt(empty_values = false, value_name = "PACKAGE", required = true)] packages: Vec<String>, } impl CliCommand for Install { fn run(self, _flags: GlobalFlags) -> Result<(), String> { unimplemented!() } }
// Copyright 2022 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #![allow(clippy::uninlined_format_args)] #![feature(type_alias_impl_trait)] mod build_options_table; mod catalogs_table; mod clustering_history_table; mod clusters_table; mod columns_table; mod configs_table; mod contributors_table; mod credits_table; mod databases_table; mod engines_table; mod functions_table; mod log_queue; mod malloc_stats_table; mod malloc_stats_totals_table; mod metrics_table; mod one_table; mod processes_table; mod query_cache_table; mod query_log_table; mod roles_table; mod settings_table; mod stages_table; mod table; mod table_functions_table; mod tables_table; mod tracing_table; mod users_table; pub use build_options_table::BuildOptionsTable; pub use catalogs_table::CatalogsTable; pub use clustering_history_table::ClusteringHistoryLogElement; pub use clustering_history_table::ClusteringHistoryQueue; pub use clustering_history_table::ClusteringHistoryTable; pub use clusters_table::ClustersTable; pub use columns_table::ColumnsTable; pub use configs_table::ConfigsTable; pub use contributors_table::ContributorsTable; pub use credits_table::CreditsTable; pub use databases_table::DatabasesTable; pub use engines_table::EnginesTable; pub use functions_table::FunctionsTable; pub use log_queue::SystemLogElement; pub use log_queue::SystemLogQueue; pub use log_queue::SystemLogTable; pub use malloc_stats_table::MallocStatsTable; pub use malloc_stats_totals_table::MallocStatsTotalsTable; pub use metrics_table::MetricsTable; pub use one_table::OneTable; pub use processes_table::ProcessesTable; pub use query_cache_table::QueryCacheTable; pub use query_log_table::LogType; pub use query_log_table::QueryLogElement; pub use query_log_table::QueryLogQueue; pub use query_log_table::QueryLogTable; pub use roles_table::RolesTable; pub use settings_table::SettingsTable; pub use stages_table::StagesTable; pub use table::SyncOneBlockSystemTable; pub use table::SyncSystemTable; pub use table_functions_table::TableFunctionsTable; pub use tables_table::TablesTable; pub use tables_table::TablesTableWithHistory; pub use tables_table::TablesTableWithoutHistory; pub use tracing_table::TracingTable; pub use users_table::UsersTable;
mod read_file; use std::io; fn main(){ let greeting = "Welcome to the software!\nPlease choose from the following menu: \n 1. Read from a file. \n 2. Write to a file.".to_string(); loop { println!("{}", greeting); let mut input = String::new(); io::stdin().read_line(&mut input).unwrap(); println!(); println!(); match input.trim() { "1" => { match read_file::read_file() { Ok(()) => (), Err(_) => println!("Error reading from file") } }, "3" => break, _ => println!("Incorrect Input. Please try again."), } } println!("End of Program."); }
use once_cell::sync::Lazy; use std::num::ParseIntError; use pyo3::exceptions::PyValueError; use pyo3::prelude::*; use pyo3::types::PyDict; use regex::Regex; use ukis_h3cellstore::clickhouse::compacted_tables::schema::{ AggregationMethod, ClickhouseDataType, ColumnDefinition, CompactedTableSchema, CompactedTableSchemaBuilder, CompressionMethod, H3Partitioning, SimpleColumn, TableEngine, TemporalPartitioning, TemporalResolution, ValidateSchema, }; use crate::error::IntoPyResult; use crate::utils::extract_dict_item_option; #[pyclass] pub struct PyCompactedTableSchema { pub schema: CompactedTableSchema, } #[pymethods] impl PyCompactedTableSchema { fn validate(&self) -> PyResult<()> { self.schema.validate().into_pyresult() } #[getter] fn name(&self) -> String { self.schema.name.clone() } #[getter] fn max_h3_resolution(&self) -> u8 { self.schema.max_h3_resolution } fn to_json_string(&self) -> PyResult<String> { serde_json::to_string(&self.schema).into_pyresult() } #[staticmethod] fn from_json_string(instr: String) -> PyResult<Self> { Ok(Self { schema: serde_json::from_str(instr.as_str()).into_pyresult()?, }) } fn sql_statements(&self) -> PyResult<Vec<String>> { self.schema.build_create_statements(&None).into_pyresult() } } #[pyclass] pub struct PyCompressionMethod { compression_method: CompressionMethod, } #[pymethods] impl PyCompressionMethod { #[new] #[pyo3(signature = (method_name, method_param = None))] pub fn new(method_name: String, method_param: Option<u8>) -> PyResult<Self> { let compression_method = match method_name.to_lowercase().as_str() { "lz4hc" => CompressionMethod::LZ4HC(method_param.unwrap_or(9)), "zstd" => CompressionMethod::ZSTD(method_param.unwrap_or(6)), "delta" => CompressionMethod::Delta(method_param.unwrap_or(1)), "doubledelta" => CompressionMethod::DoubleDelta, "gorilla" => CompressionMethod::Gorilla, "t64" => CompressionMethod::T64, _ => { return Err(PyValueError::new_err(format!( "Unsupported compression method: {}", method_name ))) } }; Ok(Self { compression_method }) } } static RE_TEMPORAL_PARTITIONING: Lazy<Regex> = Lazy::new(|| Regex::new(r"^(([0-9]+)\s*)?([a-zA-Z]+)$").unwrap()); #[pyclass] pub struct PyCompactedTableSchemaBuilder { table_name: String, table_engine: Option<TableEngine>, compression_method: Option<CompressionMethod>, h3_base_resolutions: Option<Vec<u8>>, use_compaction: bool, temporal_resolution: Option<TemporalResolution>, temporal_partitioning: Option<TemporalPartitioning>, h3_partitioning: Option<H3Partitioning>, partition_by: Option<Vec<String>>, columns: Vec<(String, ColumnDefinition)>, } #[pymethods] impl PyCompactedTableSchemaBuilder { #[new] fn new(table_name: String) -> Self { Self { table_name, table_engine: None, compression_method: None, h3_base_resolutions: None, use_compaction: true, temporal_resolution: None, temporal_partitioning: None, h3_partitioning: None, partition_by: None, columns: vec![], } } #[pyo3(signature = (engine_name, column_names = None))] fn table_engine( &mut self, engine_name: String, column_names: Option<Vec<String>>, ) -> PyResult<()> { self.table_engine = Some(match engine_name.to_lowercase().as_str() { "replacingmergetree" => TableEngine::ReplacingMergeTree, "aggregatingmergetree" => TableEngine::AggregatingMergeTree, "summingmergetree" => { if let Some(sum_column_names) = column_names { TableEngine::SummingMergeTree(sum_column_names) } else { return Err(PyValueError::new_err("names of columns are required")); } } _ => { return Err(PyValueError::new_err(format!( "Unsupported table engine: {}", engine_name ))) } }); Ok(()) } fn compression_method(&mut self, compression_method: &PyCompressionMethod) { self.compression_method = Some(compression_method.compression_method.clone()); } fn use_compacted_resolutions(&mut self, use_compaction: bool) { self.use_compaction = use_compaction; } fn h3_base_resolutions(&mut self, res: Vec<u8>) { self.h3_base_resolutions = Some(res) } #[pyo3(signature = (column_name, datatype_str, **kwargs))] fn add_column( &mut self, column_name: String, datatype_str: String, kwargs: Option<&PyDict>, ) -> PyResult<()> { let column_kwargs = ColumnKwargs::extract(kwargs)?; let sc = SimpleColumn::new( datatype_from_string(datatype_str)?, column_kwargs.order_key_position, column_kwargs .compression_method .map(|pcm| pcm.compression_method.clone()), column_kwargs.nullable, ); self.columns .push((column_name, ColumnDefinition::Simple(sc))); Ok(()) } fn add_h3index_column(&mut self, column_name: String) { self.columns.push((column_name, ColumnDefinition::H3Index)); } /// /// /// The `min`, `max` and `avg` aggregations only work on the cells included in the data. Are /// not all child-cells included, the missing ones are simply omitted and not assumed to be `0`. #[pyo3(signature = (column_name, datatype_str, agg_method_str, **kwargs))] fn add_aggregated_column( &mut self, column_name: String, datatype_str: String, agg_method_str: String, kwargs: Option<&PyDict>, ) -> PyResult<()> { let column_kwargs = ColumnKwargs::extract(kwargs)?; let sc = SimpleColumn::new( datatype_from_string(datatype_str)?, column_kwargs.order_key_position, column_kwargs .compression_method .map(|pcm| pcm.compression_method.clone()), column_kwargs.nullable, ); let agg = match agg_method_str.to_lowercase().as_str() { "sum" => AggregationMethod::Sum, "min" => AggregationMethod::Min, "max" => AggregationMethod::Max, "avg" | "average" => AggregationMethod::Average, "relativetoarea" | "relativetocellarea" => AggregationMethod::RelativeToCellArea, "setnullonconflict" => AggregationMethod::SetNullOnConflict, _ => { return Err(PyValueError::new_err(format!( "Unsupported aggregation method: {}", agg_method_str ))) } }; self.columns .push((column_name, ColumnDefinition::WithAggregation(sc, agg))); Ok(()) } fn temporal_resolution(&mut self, name: String) -> PyResult<()> { self.temporal_resolution = Some(match name.to_lowercase().as_str() { "second" | "seconds" => TemporalResolution::Second, "day" | "days" => TemporalResolution::Day, _ => { return Err(PyValueError::new_err(format!( "Unsupported temporal resolution: {}", name ))) } }); Ok(()) } fn temporal_partitioning(&mut self, name: String) -> PyResult<()> { let cap = RE_TEMPORAL_PARTITIONING.captures(&name).ok_or_else(|| { PyValueError::new_err(format!("Invalid temporal partitioning given: '{}'", name)) })?; let unit_string = cap .get(3) .map(|s| s.as_str().to_lowercase()) .unwrap_or_else(|| "".to_string()); self.temporal_partitioning = Some(match unit_string.as_str() { "month" | "months" => { let num_months: u8 = cap .get(2) .map(|s| { s.as_str().parse().map_err(|e: ParseIntError| { PyValueError::new_err(format!( "Invalid number of months in temporal partitioning: {}", e )) }) }) .unwrap_or_else(|| Ok(1_u8))?; TemporalPartitioning::Months(num_months) } "year" | "years" => { let num_years: u8 = cap .get(2) .map(|s| { s.as_str().parse().map_err(|e: ParseIntError| { PyValueError::new_err(format!( "Invalid number of years in temporal partitioning: {}", e )) }) }) .unwrap_or_else(|| Ok(1_u8))?; TemporalPartitioning::Years(num_years) } _ => { return Err(PyValueError::new_err(format!( "Invalid temporal partitioning time unit given: '{}'", unit_string ))) } }); Ok(()) } #[pyo3(signature = (name, **kwargs))] fn h3_partitioning(&mut self, name: String, kwargs: Option<&PyDict>) -> PyResult<()> { self.h3_partitioning = match name.to_lowercase().as_str() { "basecell" => Some(H3Partitioning::BaseCell), "lower_resolution" | "lr" => { let mut resolution_difference = 8u8; if let Some(dict) = kwargs { resolution_difference = extract_dict_item_option(dict, "resolution_difference")? .unwrap_or(resolution_difference); } Some(H3Partitioning::LowerResolution(resolution_difference)) } _ => { return Err(PyValueError::new_err(format!( "Invalid h3 partitioning given: '{}'", name ))) } }; Ok(()) } fn partition_by(&mut self, column_names: Vec<String>) { self.partition_by = Some(column_names) } fn build(&self) -> PyResult<PyCompactedTableSchema> { let mut builder = CompactedTableSchemaBuilder::new(&self.table_name); if let Some(te) = &self.table_engine { builder = builder.table_engine(te.clone()) } if let Some(cm) = &self.compression_method { builder = builder.compression_method(cm.clone()) } builder = builder.use_compacted_resolutions(self.use_compaction); if let Some(h3res) = &self.h3_base_resolutions { builder = builder.h3_base_resolutions(h3res.clone()) } if let Some(tr) = &self.temporal_resolution { builder = builder.temporal_resolution(tr.clone()); } if let Some(tp) = &self.temporal_partitioning { builder = builder.temporal_partitioning(tp.clone()); } if let Some(hp) = &self.h3_partitioning { builder = builder.h3_partitioning(hp.clone()); } if let Some(pb) = &self.partition_by { builder = builder.partition_by(pb.clone()) } for (col_name, col_def) in self.columns.iter() { builder = builder.add_column(col_name.as_str(), col_def.clone()) } let inner_schema = builder.build().into_pyresult()?; Ok(PyCompactedTableSchema { schema: inner_schema, }) } } fn datatype_from_string(datatype_string: String) -> PyResult<ClickhouseDataType> { // todo: implement FromStr and use that instead of serde serde_json::from_str(&format!("\"{}\"", datatype_string)) .map_err(|_e| PyValueError::new_err(format!("Unknown datatype: {}", datatype_string))) } #[derive(Default)] struct ColumnKwargs<'a> { order_key_position: Option<u8>, compression_method: Option<PyRef<'a, PyCompressionMethod>>, nullable: bool, } impl<'a> ColumnKwargs<'a> { fn extract(dict: Option<&'a PyDict>) -> PyResult<Self> { let mut kwargs = Self::default(); if let Some(dict) = dict { let nullable: Option<bool> = extract_dict_item_option(dict, "nullable")?; kwargs.order_key_position = extract_dict_item_option(dict, "order_key_position")?; kwargs.compression_method = extract_dict_item_option(dict, "compression_method")?; kwargs.nullable = nullable.unwrap_or(false); } Ok(kwargs) } }
#![allow(dead_code)] #![allow(unused_imports)] use super::*; use super::poppy as pop; pub struct Louds { packed_bits: pop::Poppy<u64>, }
//! Contains types related to the [`World`] entity collection. use std::{ collections::HashMap, mem, ops::Range, sync::atomic::{AtomicU64, Ordering}, }; use bit_set::BitSet; use itertools::Itertools; use super::{ entity::{Allocate, Entity, EntityHasher, EntityLocation, LocationMap, ID_CLONE_MAPPINGS}, entry::{Entry, EntryMut, EntryRef}, event::{EventSender, Subscriber, Subscribers}, insert::{ArchetypeSource, ArchetypeWriter, ComponentSource, IntoComponentSource}, query::{ filter::{EntityFilter, LayoutFilter}, view::{IntoView, View}, Query, }, storage::{ archetype::{Archetype, ArchetypeIndex, EntityLayout}, component::{Component, ComponentTypeId}, group::{Group, GroupDef}, index::SearchIndex, ComponentIndex, Components, PackOptions, UnknownComponentStorage, }, subworld::{ComponentAccess, SubWorld}, }; type MapEntry<'a, K, V> = std::collections::hash_map::Entry<'a, K, V>; /// Error type representing a failure to access entity data. #[derive(thiserror::Error, Debug, Eq, PartialEq, Hash)] pub enum EntityAccessError { /// Attempted to access an entity which lies outside of the subworld. #[error("this world does not have permission to access the entity")] AccessDenied, /// Attempted to access an entity which does not exist. #[error("the entity does not exist")] EntityNotFound, } /// The `EntityStore` trait abstracts access to entity data as required by queries for /// both [`World`] and [`SubWorld`] pub trait EntityStore { /// Returns the world's unique ID. fn id(&self) -> WorldId; /// Returns an entity entry which can be used to access entity metadata and components. fn entry_ref(&self, entity: Entity) -> Result<EntryRef, EntityAccessError>; /// Returns a mutable entity entry which can be used to access entity metadata and components. fn entry_mut(&mut self, entity: Entity) -> Result<EntryMut, EntityAccessError>; /// Returns a component storage accessor for component types declared in the specified [`View`]. fn get_component_storage<V: for<'b> View<'b>>( &self, ) -> Result<StorageAccessor, EntityAccessError>; } /// Unique identifier for a [`World`]. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct WorldId(u64); static WORLD_ID_COUNTER: AtomicU64 = AtomicU64::new(0); impl WorldId { fn next() -> Self { WorldId(WORLD_ID_COUNTER.fetch_add(1, Ordering::Relaxed)) } } impl Default for WorldId { fn default() -> Self { Self::next() } } /// Describes configuration options for the creation of a new [`World`]. #[derive(Default)] pub struct WorldOptions { /// A vector of component [`GroupDef`]s to provide layout hints for query optimization. pub groups: Vec<GroupDef>, } /// A container of entities. /// /// Each entity stored inside a world is uniquely identified by an [`Entity`] ID and may have an /// arbitrary collection of [`Component`]s attached. /// /// The entities in a world may be efficiently searched and iterated via [queries](crate::query). #[derive(Debug)] pub struct World { id: WorldId, index: SearchIndex, components: Components, groups: Vec<Group>, group_members: HashMap<ComponentTypeId, usize>, archetypes: Vec<Archetype>, entities: LocationMap, allocation_buffer: Vec<Entity>, subscribers: Subscribers, } impl Default for World { fn default() -> Self { Self::new(WorldOptions::default()) } } impl World { /// Creates a new world with the given options, pub fn new(options: WorldOptions) -> Self { let groups: Vec<Group> = options.groups.into_iter().map(|def| def.into()).collect(); let mut group_members = HashMap::default(); for (i, group) in groups.iter().enumerate() { for comp in group.components() { match group_members.entry(comp) { MapEntry::Vacant(entry) => { entry.insert(i); } MapEntry::Occupied(_) => { panic!("components can only belong to a single group"); } } } } Self { id: WorldId::next(), index: SearchIndex::default(), components: Components::default(), groups, group_members, archetypes: Vec::default(), entities: LocationMap::default(), allocation_buffer: Vec::default(), subscribers: Subscribers::default(), } } /// Returns the world's unique ID. pub fn id(&self) -> WorldId { self.id } /// Returns the number of entities in the world. pub fn len(&self) -> usize { self.entities.len() } /// Returns `true` if the world contains no entities. pub fn is_empty(&self) -> bool { self.len() == 0 } /// Returns `true` if the world contains an entity with the given ID. pub fn contains(&self, entity: Entity) -> bool { self.entities.contains(entity) } /// Appends a named entity to the word, replacing any existing entity with the given ID. pub fn push_with_id<T>(&mut self, entity_id: Entity, components: T) where Option<T>: IntoComponentSource, { self.remove(entity_id); let mut components = <Option<T> as IntoComponentSource>::into(Some(components)); let arch_index = self.get_archetype_for_components(&mut components); let archetype = &mut self.archetypes[arch_index.0 as usize]; let mut writer = ArchetypeWriter::new(arch_index, archetype, self.components.get_multi_mut()); components.push_components(&mut writer, std::iter::once(entity_id)); let (base, entities) = writer.inserted(); self.entities.insert(entities, arch_index, base); } /// Appends a new entity to the world. Returns the ID of the new entity. /// `components` should be a tuple of components to attach to the entity. /// /// # Examples /// /// Pushing an entity with three components: /// ``` /// # use legion::*; /// let mut world = World::default(); /// let _entity = world.push((1usize, false, 5.3f32)); /// ``` /// /// Pushing an entity with one component (note the tuple syntax): /// ``` /// # use legion::*; /// let mut world = World::default(); /// let _entity = world.push((1usize,)); /// ``` pub fn push<T>(&mut self, components: T) -> Entity where Option<T>: IntoComponentSource, { struct One(Option<Entity>); impl<'a> Extend<&'a Entity> for One { fn extend<I: IntoIterator<Item = &'a Entity>>(&mut self, iter: I) { debug_assert!(self.0.is_none()); let mut iter = iter.into_iter(); self.0 = iter.next().copied(); debug_assert!(iter.next().is_none()); } } let mut o = One(None); self.extend_out(Some(components), &mut o); o.0.unwrap() } /// Appends a collection of entities to the world. Returns the IDs of the new entities. /// /// # Examples /// /// Inserting a vector of component tuples: /// ``` /// # use legion::*; /// let mut world = World::default(); /// let _entities = world.extend(vec![ /// (1usize, false, 5.3f32), /// (2usize, true, 5.3f32), /// (3usize, false, 5.3f32), /// ]); /// ``` /// /// Inserting a tuple of component vectors: /// ``` /// # use legion::*; /// let mut world = World::default(); /// let _entities = world.extend( /// ( /// vec![1usize, 2usize, 3usize], /// vec![false, true, false], /// vec![5.3f32, 5.3f32, 5.2f32], /// ) /// .into_soa(), /// ); /// ``` /// SoA inserts require all vectors to have the same length. These inserts are faster than inserting via an iterator of tuples. pub fn extend(&mut self, components: impl IntoComponentSource) -> &[Entity] { let mut self_alloc_buf = mem::take(&mut self.allocation_buffer); self_alloc_buf.clear(); self.extend_out(components, &mut self_alloc_buf); self.allocation_buffer = self_alloc_buf; &self.allocation_buffer } /// Appends a collection of entities to the world. /// Extends the given `out` collection with the IDs of the new entities. /// /// # Examples /// /// Inserting a vector of component tuples: /// /// ``` /// # use legion::*; /// let mut world = World::default(); /// let mut entities = Vec::new(); /// world.extend_out( /// vec![ /// (1usize, false, 5.3f32), /// (2usize, true, 5.3f32), /// (3usize, false, 5.3f32), /// ], /// &mut entities, /// ); /// ``` /// /// Inserting a tuple of component vectors: /// /// ``` /// # use legion::*; /// let mut world = World::default(); /// let mut entities = Vec::new(); /// // SoA inserts require all vectors to have the same length. /// // These inserts are faster than inserting via an iterator of tuples. /// world.extend_out( /// ( /// vec![1usize, 2usize, 3usize], /// vec![false, true, false], /// vec![5.3f32, 5.3f32, 5.2f32], /// ) /// .into_soa(), /// &mut entities, /// ); /// ``` /// /// The collection type is generic over [`Extend`], thus any collection could be used: /// /// ``` /// # use legion::*; /// let mut world = World::default(); /// let mut entities = std::collections::VecDeque::new(); /// world.extend_out( /// vec![ /// (1usize, false, 5.3f32), /// (2usize, true, 5.3f32), /// (3usize, false, 5.3f32), /// ], /// &mut entities, /// ); /// ``` /// /// [`Extend`]: std::iter::Extend pub fn extend_out<S, E>(&mut self, components: S, out: &mut E) where S: IntoComponentSource, E: for<'a> Extend<&'a Entity>, { let replaced = { let mut components = components.into(); let arch_index = self.get_archetype_for_components(&mut components); let archetype = &mut self.archetypes[arch_index.0 as usize]; let mut writer = ArchetypeWriter::new(arch_index, archetype, self.components.get_multi_mut()); components.push_components(&mut writer, Allocate::new()); let (base, entities) = writer.inserted(); let r = self.entities.insert(entities, arch_index, base); // Extend the given collection with inserted entities. out.extend(entities.iter()); r }; for location in replaced { self.remove_at_location(location); } } /// Removes the specified entity from the world. Returns `true` if an entity was removed. pub fn remove(&mut self, entity: Entity) -> bool { let location = self.entities.remove(entity); if let Some(location) = location { self.remove_at_location(location); true } else { false } } fn remove_at_location(&mut self, location: EntityLocation) { let EntityLocation(arch_index, component_index) = location; let archetype = &mut self.archetypes[arch_index]; archetype.swap_remove(component_index.0); for type_id in archetype.layout().component_types() { let storage = self.components.get_mut(*type_id).unwrap(); storage.swap_remove(arch_index, component_index); } if component_index.0 < archetype.entities().len() { let swapped = archetype.entities()[component_index.0]; self.entities.set(swapped, location); } } /// Removes all entities from the world. pub fn clear(&mut self) { use crate::internals::query::IntoQuery; let mut all = Entity::query(); let entities = all.iter(self).copied().collect::<Vec<_>>(); for entity in entities { self.remove(entity); } } /// Gets an [`Entry`] for an entity, allowing manipulation of the entity. /// /// # Examples /// /// Adding a component to an entity: /// ``` /// # use legion::*; /// let mut world = World::default(); /// let entity = world.push((true, 0isize)); /// if let Some(mut entry) = world.entry(entity) { /// entry.add_component(0.2f32); /// } /// ``` pub fn entry(&mut self, entity: Entity) -> Option<Entry> { self.entities .get(entity) .map(move |location| Entry::new(location, self)) } pub(crate) unsafe fn entry_unchecked( &self, entity: Entity, ) -> Result<EntryMut, EntityAccessError> { self.entities .get(entity) .map(|location| { EntryMut::new( location, &self.components, &self.archetypes, ComponentAccess::All, ) }) .ok_or(EntityAccessError::EntityNotFound) } /// Subscribes to entity [`Event`](super::event::Event)s. pub fn subscribe<T, S>(&mut self, sender: S, filter: T) where T: LayoutFilter + Send + Sync + 'static, S: EventSender + 'static, { let subscriber = Subscriber::new(filter, sender); for arch in &mut self.archetypes { if subscriber.is_interested(arch) { arch.subscribe(subscriber.clone()); } } self.subscribers.push(subscriber); } /// Packs the world's internal component storage to optimise iteration performance for /// [queries](crate::query) which match a [`GroupDef`] defined when this world was created. pub fn pack(&mut self, options: PackOptions) { self.components.pack(&options); } /// Returns the raw component storage. pub fn components(&self) -> &Components { &self.components } pub(crate) fn components_mut(&mut self) -> &mut Components { &mut self.components } pub(crate) fn archetypes(&self) -> &[Archetype] { &self.archetypes } pub(crate) unsafe fn transfer_archetype( &mut self, ArchetypeIndex(from): ArchetypeIndex, ArchetypeIndex(to): ArchetypeIndex, ComponentIndex(idx): ComponentIndex, ) -> ComponentIndex { if from == to { return ComponentIndex(idx); } // find archetypes let (from_arch, to_arch) = if from < to { let (a, b) = self.archetypes.split_at_mut(to as usize); (&mut a[from as usize], &mut b[0]) } else { let (a, b) = self.archetypes.split_at_mut(from as usize); (&mut b[0], &mut a[to as usize]) }; // move entity ID let entity = from_arch.swap_remove(idx); to_arch.push(entity); self.entities.set( entity, EntityLocation::new( ArchetypeIndex(to), ComponentIndex(to_arch.entities().len() - 1), ), ); if from_arch.entities().len() > idx { let moved = from_arch.entities()[idx]; self.entities.set( moved, EntityLocation::new(ArchetypeIndex(from), ComponentIndex(idx)), ); } // move components let from_layout = from_arch.layout(); let to_layout = to_arch.layout(); for type_id in from_layout.component_types() { let storage = self.components.get_mut(*type_id).unwrap(); if to_layout.component_types().contains(type_id) { storage.move_component( ArchetypeIndex(from), ComponentIndex(idx), ArchetypeIndex(to), ); } else { storage.swap_remove(ArchetypeIndex(from), ComponentIndex(idx)); } } ComponentIndex(to_arch.entities().len() - 1) } pub(crate) fn get_archetype_for_components<T: ArchetypeSource>( &mut self, components: &mut T, ) -> ArchetypeIndex { let index = self.index.search(&components.filter()).next(); if let Some(index) = index { index } else { self.insert_archetype(components.layout()) } } fn insert_archetype(&mut self, layout: EntityLayout) -> ArchetypeIndex { // create and insert new archetype self.index.push(&layout); let arch_index = ArchetypeIndex(self.archetypes.len() as u32); let subscribers = self.subscribers.matches_layout(layout.component_types()); self.archetypes .push(Archetype::new(arch_index, layout, subscribers)); let archetype = &self.archetypes[self.archetypes.len() - 1]; // find all groups which contain each component let groups = &mut self.groups; let group_members = &mut self.group_members; let types_by_group = archetype .layout() .component_types() .iter() .map(|type_id| { ( match group_members.entry(*type_id) { MapEntry::Occupied(entry) => *entry.get(), MapEntry::Vacant(entry) => { // create a group for the component (by itself) if it does not already have one let mut group = GroupDef::new(); group.add(*type_id); groups.push(group.into()); *entry.insert(groups.len() - 1) } }, *type_id, ) }) .into_group_map(); // insert the archetype into each component storage for (group_index, component_types) in types_by_group.iter() { let group = &mut self.groups[*group_index]; let index = group.try_insert(arch_index, archetype); for type_id in component_types { let storage = self.components.get_or_insert_with(*type_id, || { let index = archetype .layout() .component_types() .iter() .position(|t| t == type_id) .unwrap(); archetype.layout().component_constructors()[index]() }); storage.insert_archetype(arch_index, index); } } arch_index } /// Splits the world into two. The left world allows access only to the data declared by the view; /// the right world allows access to all else. /// /// # Examples /// /// ``` /// # use legion::*; /// # struct Position; /// # let mut world = World::default(); /// let (left, right) = world.split::<&mut Position>(); /// ``` /// /// With the above, 'left' contains a sub-world with access _only_ to `&Position` and `&mut Position`, /// and `right` contains a sub-world with access to everything _but_ `&Position` and `&mut Position`. /// /// ``` /// # use legion::*; /// # struct Position; /// # let mut world = World::default(); /// let (left, right) = world.split::<&Position>(); /// ``` /// /// In this second example, `left` is provided access _only_ to `&Position`. `right` is granted permission /// to everything _but_ `&mut Position`. pub fn split<T: IntoView>(&mut self) -> (SubWorld, SubWorld) { let permissions = T::View::requires_permissions(); let (left, right) = ComponentAccess::All.split(permissions); // safety: exclusive access to world, and we have split each subworld into disjoint sections unsafe { ( SubWorld::new_unchecked(self, left, None), SubWorld::new_unchecked(self, right, None), ) } } /// Splits the world into two. The left world allows access only to the data declared by the query's view; /// the right world allows access to all else. pub fn split_for_query<'q, V: IntoView, F: EntityFilter>( &mut self, _: &'q Query<V, F>, ) -> (SubWorld, SubWorld) { self.split::<V>() } /// Merges the given world into this world by moving all entities out of the source world. pub fn move_from<F: LayoutFilter>(&mut self, source: &mut World, filter: &F) { // find the archetypes in the source that we want to merge into the destination for src_arch in source.archetypes.iter_mut().filter(|arch| { filter .matches_layout(arch.layout().component_types()) .is_pass() }) { // find conflicts, and remove the existing entity, to be replaced with that defined in the source for src_entity in src_arch.entities() { self.remove(*src_entity); } // find or construct the destination archetype let layout = &**src_arch.layout(); let dst_arch_index = if src_arch.entities().len() < 32 { self.index.search(layout).next() } else { None }; let dst_arch_index = dst_arch_index.unwrap_or_else(|| self.insert_archetype(layout.clone())); let dst_arch = &mut self.archetypes[dst_arch_index.0 as usize]; // build a writer for the destination archetype let mut writer = ArchetypeWriter::new(dst_arch_index, dst_arch, self.components.get_multi_mut()); // push entity IDs into the archetype for entity in src_arch.entities() { writer.push(*entity); } // merge components into the archetype for component in src_arch.layout().component_types() { let src_storage = source.components.get_mut(*component).unwrap(); let mut dst_storage = writer.claim_components_unknown(*component); dst_storage.move_archetype_from(src_arch.index(), src_storage); } for entity in src_arch.drain() { source.entities.remove(entity); } // record entity locations let (base, entities) = writer.inserted(); self.entities.insert(entities, dst_arch_index, base); } } /// Clones the entities from a world into this world. /// /// A [`LayoutFilter`] selects which entities to merge. /// A [`Merger`] describes how to perform the merge operation. /// /// If any entity IDs are remapped by the policy, their mappings will be returned in the result. /// /// More advanced operations such as component type transformations can be performed with the /// [`Duplicate`] merger. /// /// # Examples /// /// Cloning all entities from the source world, converting all `i32` components to `f64` components. /// ``` /// # use legion::*; /// # use legion::world::Duplicate; /// let mut world_a = World::default(); /// let mut world_b = World::default(); /// /// // any component types not registered with Duplicate will be ignored during the merge /// let mut merger = Duplicate::default(); /// merger.register_copy::<isize>(); // copy is faster than clone /// merger.register_clone::<String>(); /// merger.register_convert(|comp: &i32| *comp as f32); /// /// let _ = world_a.clone_from(&world_b, &any(), &mut merger); /// ``` pub fn clone_from<F: LayoutFilter, M: Merger>( &mut self, source: &World, filter: &F, merger: &mut M, ) -> HashMap<Entity, Entity, EntityHasher> { let mut allocator = Allocate::new(); let mut reallocated = HashMap::default(); // assign destination IDs for src_arch in source.archetypes.iter().filter(|arch| { filter .matches_layout(arch.layout().component_types()) .is_pass() }) { // find conflicts, and remove the existing entity, to be replaced with that defined in the source for src_entity in src_arch.entities() { let dst_entity = merger.assign_id(*src_entity, &mut allocator); self.remove(dst_entity); reallocated.insert(*src_entity, dst_entity); } } let mut reallocated = Some(reallocated); let mut mappings = match merger.entity_map() { EntityRewrite::Auto(Some(mut overrides)) => { for (a, b) in reallocated.as_ref().unwrap().iter() { overrides.entry(*a).or_insert(*b); } overrides } EntityRewrite::Auto(None) => reallocated.take().unwrap(), EntityRewrite::Explicit(overrides) => overrides, }; // set the entity mappings as context for Entity::clone ID_CLONE_MAPPINGS.with(|cell| { std::mem::swap(&mut *cell.borrow_mut(), &mut mappings); }); // clone entities for src_arch in source.archetypes.iter().filter(|arch| { filter .matches_layout(arch.layout().component_types()) .is_pass() }) { // construct the destination entity layout let layout = merger.convert_layout((**src_arch.layout()).clone()); // find or construct the destination archetype let dst_arch_index = if !M::prefers_new_archetype() || src_arch.entities().len() < 32 { self.index.search(&layout).next() } else { None }; let dst_arch_index = dst_arch_index.unwrap_or_else(|| self.insert_archetype(layout)); let dst_arch = &mut self.archetypes[dst_arch_index.0 as usize]; // build a writer for the destination archetype let mut writer = ArchetypeWriter::new(dst_arch_index, dst_arch, self.components.get_multi_mut()); // push entity IDs into the archetype ID_CLONE_MAPPINGS.with(|cell| { let map = cell.borrow(); for entity in src_arch.entities() { let entity = map.get(entity).unwrap_or(entity); writer.push(*entity); } }); // merge components into the archetype merger.merge_archetype( 0..src_arch.entities().len(), src_arch, &source.components, &mut writer, ); // record entity locations let (base, entities) = writer.inserted(); self.entities.insert(entities, dst_arch_index, base); } reallocated.unwrap_or_else(|| { // switch the map context back to recover our hashmap ID_CLONE_MAPPINGS.with(|cell| { std::mem::swap(&mut *cell.borrow_mut(), &mut mappings); }); mappings }) } /// Clones a single entity from the source world into the destination world. pub fn clone_from_single<M: Merger>( &mut self, source: &World, entity: Entity, merger: &mut M, ) -> Entity { // determine the destination ID let mut allocator = Allocate::new(); let dst_entity = merger.assign_id(entity, &mut allocator); // find conflicts, and remove the existing entity, to be replaced with that defined in the source self.remove(dst_entity); // find the source let src_location = source .entities .get(entity) .expect("entity not found in source world"); let src_arch = &source.archetypes[src_location.archetype()]; // construct the destination entity layout let layout = merger.convert_layout((**src_arch.layout()).clone()); // find or construct the destination archetype let dst_arch_index = self.insert_archetype(layout); let dst_arch = &mut self.archetypes[dst_arch_index.0 as usize]; // build a writer for the destination archetype let mut writer = ArchetypeWriter::new(dst_arch_index, dst_arch, self.components.get_multi_mut()); // push the entity ID into the archetype writer.push(dst_entity); let mut mappings = match merger.entity_map() { EntityRewrite::Auto(Some(mut overrides)) => { overrides.entry(entity).or_insert(dst_entity); overrides } EntityRewrite::Auto(None) => { let mut map = HashMap::default(); map.insert(entity, dst_entity); map } EntityRewrite::Explicit(overrides) => overrides, }; // set the entity mappings as context for Entity::clone ID_CLONE_MAPPINGS.with(|cell| { std::mem::swap(&mut *cell.borrow_mut(), &mut mappings); }); // merge components into the archetype let index = src_location.component().0; merger.merge_archetype( index..(index + 1), src_arch, &source.components, &mut writer, ); // record entity location let (base, entities) = writer.inserted(); self.entities.insert(entities, dst_arch_index, base); ID_CLONE_MAPPINGS.with(|cell| { cell.borrow_mut().clear(); }); dst_entity } /// Creates a serde serializable representation of the world. /// /// A [`LayoutFilter`] selects which entities shall be serialized. /// A [`WorldSerializer`](super::serialize::ser::WorldSerializer) describes how components will /// be serialized. /// /// As component types are not known at compile time, the world must be provided with the /// means to serialize each component. This is provided by the /// [`WorldSerializer`](super::serialize::ser::WorldSerializer) implementation. This implementation /// also describes how [`ComponentTypeId`]s (which are not stable between compiles) are mapped to /// stable type identifiers. Components that are not known to the serializer will be omitted from /// the serialized output. /// /// The [`Registry`](super::serialize::Registry) provides a /// [`WorldSerializer`](super::serialize::ser::WorldSerializer) implementation suitable for most /// situations. /// /// # Examples /// /// Serializing all entities with a `Position` component to JSON. /// ``` /// # use legion::*; /// # use legion::serialize::Canon; /// # let world = World::default(); /// # #[derive(serde::Serialize, serde::Deserialize)] /// # struct Position; /// // create a registry which uses strings as the external type ID /// let mut registry = Registry::<String>::default(); /// registry.register::<Position>("position".to_string()); /// registry.register::<f32>("f32".to_string()); /// registry.register::<bool>("bool".to_string()); /// /// // serialize entities with the `Position` component /// let entity_serializer = Canon::default(); /// let json = serde_json::to_value(&world.as_serializable( /// component::<Position>(), /// &registry, /// &entity_serializer, /// )) /// .unwrap(); /// println!("{:#}", json); /// /// // registries can also be used to deserialize /// use serde::de::DeserializeSeed; /// let world: World = registry /// .as_deserialize(&entity_serializer) /// .deserialize(json) /// .unwrap(); /// ``` #[cfg(feature = "serialize")] pub fn as_serializable< 'a, F: LayoutFilter, W: crate::internals::serialize::ser::WorldSerializer, E: crate::internals::serialize::id::EntitySerializer, >( &'a self, filter: F, world_serializer: &'a W, entity_serializer: &'a E, ) -> crate::internals::serialize::ser::SerializableWorld<'a, F, W, E> { crate::internals::serialize::ser::SerializableWorld::new( &self, filter, world_serializer, entity_serializer, ) } } impl EntityStore for World { fn entry_ref(&self, entity: Entity) -> Result<EntryRef, EntityAccessError> { self.entities .get(entity) .map(|location| { EntryRef::new( location, &self.components, &self.archetypes, ComponentAccess::All, ) }) .ok_or(EntityAccessError::EntityNotFound) } fn entry_mut(&mut self, entity: Entity) -> Result<EntryMut, EntityAccessError> { // safety: we have exclusive access to the world unsafe { self.entry_unchecked(entity) } } fn get_component_storage<V: for<'b> View<'b>>( &self, ) -> Result<StorageAccessor, EntityAccessError> { Ok(StorageAccessor::new( self.id, &self.index, &self.components, &self.archetypes, &self.groups, &self.group_members, None, )) } fn id(&self) -> WorldId { self.id } } /// Provides access to the archetypes and entity components contained within a world. #[derive(Clone, Copy)] pub struct StorageAccessor<'a> { id: WorldId, index: &'a SearchIndex, components: &'a Components, archetypes: &'a [Archetype], groups: &'a [Group], group_members: &'a HashMap<ComponentTypeId, usize>, allowed_archetypes: Option<&'a BitSet>, } impl<'a> StorageAccessor<'a> { /// Constructs a new storage accessor. pub(crate) fn new( id: WorldId, index: &'a SearchIndex, components: &'a Components, archetypes: &'a [Archetype], groups: &'a [Group], group_members: &'a HashMap<ComponentTypeId, usize>, allowed_archetypes: Option<&'a BitSet>, ) -> Self { Self { id, index, components, archetypes, groups, group_members, allowed_archetypes, } } pub(crate) fn with_allowed_archetypes( mut self, allowed_archetypes: Option<&'a BitSet>, ) -> Self { self.allowed_archetypes = allowed_archetypes; self } /// Returns the world ID. pub fn id(&self) -> WorldId { self.id } /// Returns `true` if the given archetype is accessable from this storage accessor. pub fn can_access_archetype(&self, ArchetypeIndex(archetype): ArchetypeIndex) -> bool { match self.allowed_archetypes { None => true, Some(archetypes) => archetypes.contains(archetype as usize), } } /// Returns the archetype layout index. pub fn layout_index(&self) -> &'a SearchIndex { self.index } /// Returns the component storage. pub fn components(&self) -> &'a Components { self.components } /// Returns the archetypes. pub fn archetypes(&self) -> &'a [Archetype] { self.archetypes } /// Returns group definitions. pub fn groups(&self) -> &'a [Group] { self.groups } /// Returns the group the given component belongs to. pub fn group(&self, type_id: ComponentTypeId) -> Option<(usize, &'a Group)> { self.group_members .get(&type_id) .map(|i| (*i, self.groups.get(*i).unwrap())) } } /// Describes how to merge two [World]s. pub trait Merger { /// Indicates if the merger prefers to merge into a new empty archetype. #[inline] fn prefers_new_archetype() -> bool { false } /// Indicates how the merger wishes entity IDs to be adjusted while cloning a world. fn entity_map(&mut self) -> EntityRewrite { EntityRewrite::default() } /// Returns the ID to use in the destination world when cloning the given entity. #[inline] #[allow(unused_variables)] fn assign_id(&mut self, existing: Entity, allocator: &mut Allocate) -> Entity { allocator.next().unwrap() } /// Calculates the destination entity layout for the given source layout. #[inline] fn convert_layout(&mut self, source_layout: EntityLayout) -> EntityLayout { source_layout } /// Merges an archetype from the source world into the destination world. fn merge_archetype( &mut self, src_entity_range: Range<usize>, src_arch: &Archetype, src_components: &Components, dst: &mut ArchetypeWriter, ); } /// Describes how a merger wishes `Entity` references inside cloned components to be /// rewritten. pub enum EntityRewrite { /// Replace references to entities which have been cloned with the ID of their clone. /// May also provide a map of additional IDs to replace. Auto(Option<HashMap<Entity, Entity, EntityHasher>>), /// Replace IDs according to the given map. Explicit(HashMap<Entity, Entity, EntityHasher>), } impl Default for EntityRewrite { fn default() -> Self { Self::Auto(None) } } /// A [`Merger`] which clones entities from the source world into the destination, /// potentially performing data transformations in the process. #[derive(Default)] #[allow(clippy::type_complexity)] pub struct Duplicate { duplicate_fns: HashMap< ComponentTypeId, ( ComponentTypeId, fn() -> Box<dyn UnknownComponentStorage>, Box< dyn FnMut( Range<usize>, &Archetype, &dyn UnknownComponentStorage, &mut ArchetypeWriter, ), >, ), >, } impl Duplicate { /// Creates a new duplicate merger. pub fn new() -> Self { Self::default() } /// Allows the merger to copy the given component into the destination world. pub fn register_copy<T: Component + Copy>(&mut self) { use crate::internals::storage::ComponentStorage; let type_id = ComponentTypeId::of::<T>(); let constructor = || Box::new(T::Storage::default()) as Box<dyn UnknownComponentStorage>; let convert = Box::new( move |src_entities: Range<usize>, src_arch: &Archetype, src: &dyn UnknownComponentStorage, dst: &mut ArchetypeWriter| { let src = src.downcast_ref::<T::Storage>().unwrap(); let mut dst = dst.claim_components::<T>(); let src_slice = &src.get(src_arch.index()).unwrap().into_slice()[src_entities]; unsafe { dst.extend_memcopy(src_slice.as_ptr(), src_slice.len()) }; }, ); self.duplicate_fns .insert(type_id, (type_id, constructor, convert)); } /// Allows the merger to clone the given component into the destination world. pub fn register_clone<T: Component + Clone>(&mut self) { self.register_convert(|source: &T| source.clone()); } /// Allows the merger to clone the given component into the destination world with a custom clone function. pub fn register_convert< Source: Component, Target: Component, F: FnMut(&Source) -> Target + 'static, >( &mut self, mut convert: F, ) { use crate::internals::storage::ComponentStorage; let source_type = ComponentTypeId::of::<Source>(); let dest_type = ComponentTypeId::of::<Target>(); let constructor = || Box::new(Target::Storage::default()) as Box<dyn UnknownComponentStorage>; let convert = Box::new( move |src_entities: Range<usize>, src_arch: &Archetype, src: &dyn UnknownComponentStorage, dst: &mut ArchetypeWriter| { let src = src.downcast_ref::<Source::Storage>().unwrap(); let mut dst = dst.claim_components::<Target>(); let src_slice = &src.get(src_arch.index()).unwrap().into_slice()[src_entities]; dst.ensure_capacity(src_slice.len()); for component in src_slice { let component = convert(component); unsafe { dst.extend_memcopy(&component as *const Target, 1); std::mem::forget(component); } } }, ); self.duplicate_fns .insert(source_type, (dest_type, constructor, convert)); } /// Allows the merger to clone the given component into the destination world with a custom clone function. pub fn register_convert_raw( &mut self, src_type: ComponentTypeId, dst_type: ComponentTypeId, constructor: fn() -> Box<dyn UnknownComponentStorage>, duplicate_fn: Box< dyn FnMut(Range<usize>, &Archetype, &dyn UnknownComponentStorage, &mut ArchetypeWriter), >, ) { self.duplicate_fns .insert(src_type, (dst_type, constructor, duplicate_fn)); } } impl Merger for Duplicate { fn convert_layout(&mut self, source_layout: EntityLayout) -> EntityLayout { let mut layout = EntityLayout::new(); for src_type in source_layout.component_types() { if let Some((dst_type, constructor, _)) = self.duplicate_fns.get(src_type) { unsafe { layout.register_component_raw(*dst_type, *constructor) }; } } layout } fn merge_archetype( &mut self, src_entity_range: Range<usize>, src_arch: &Archetype, src_components: &Components, dst: &mut ArchetypeWriter, ) { for src_type in src_arch.layout().component_types() { if let Some((_, _, convert)) = self.duplicate_fns.get_mut(src_type) { let src_storage = src_components.get(*src_type).unwrap(); convert(src_entity_range.clone(), src_arch, src_storage, dst); } } } } #[cfg(test)] mod test { use super::*; use crate::internals::{insert::IntoSoa, query::filter::filter_fns::any}; #[derive(Clone, Copy, Debug, PartialEq)] struct Pos(f32, f32, f32); #[derive(Clone, Copy, Debug, PartialEq)] struct Rot(f32, f32, f32); #[test] fn create() { let _ = World::default(); } #[test] fn extend_soa() { let mut world = World::default(); let entities = world.extend((vec![1usize, 2usize, 3usize], vec![true, true, false]).into_soa()); assert_eq!(entities.len(), 3); } #[test] fn extend_soa_zerosize_component() { let mut world = World::default(); let entities = world.extend((vec![(), (), ()], vec![true, true, false]).into_soa()); assert_eq!(entities.len(), 3); } #[test] #[should_panic(expected = "all component vecs must have equal length")] fn extend_soa_unbalanced_components() { let mut world = World::default(); let _ = world.extend((vec![1usize, 2usize], vec![true, true, false]).into_soa()); } #[test] #[should_panic( expected = "only one component of a given type may be attached to a single entity" )] fn extend_soa_duplicate_components() { let mut world = World::default(); let _ = world.extend((vec![1usize, 2usize, 3usize], vec![1usize, 2usize, 3usize]).into_soa()); } #[test] fn extend_aos() { let mut world = World::default(); let entities = world.extend(vec![(1usize, true), (2usize, true), (3usize, false)]); assert_eq!(entities.len(), 3); } #[test] fn extend_aos_zerosize_component() { let mut world = World::default(); let entities = world.extend(vec![((), true), ((), true), ((), false)]); assert_eq!(entities.len(), 3); } #[test] #[should_panic( expected = "only one component of a given type may be attached to a single entity" )] fn extend_aos_duplicate_components() { let mut world = World::default(); let _ = world.extend(vec![(1usize, 1usize), (2usize, 2usize), (3usize, 3usize)]); } #[test] fn remove() { let mut world = World::default(); let entities: Vec<_> = world .extend(vec![(1usize, true), (2usize, true), (3usize, false)]) .iter() .copied() .collect(); assert_eq!(world.len(), 3); assert!(world.remove(entities[0])); assert_eq!(world.len(), 2); } #[test] fn remove_repeat() { let mut world = World::default(); let entities: Vec<_> = world .extend(vec![(1usize, true), (2usize, true), (3usize, false)]) .iter() .copied() .collect(); assert_eq!(world.len(), 3); assert!(world.remove(entities[0])); assert_eq!(world.len(), 2); assert_eq!(world.remove(entities[0]), false); assert_eq!(world.len(), 2); } #[test] fn pack() { use crate::internals::{ query::{ view::{read::Read, write::Write}, IntoQuery, }, storage::group::GroupSource, }; #[derive(Copy, Clone, Debug, PartialEq)] struct A(f32); #[derive(Copy, Clone, Debug, PartialEq)] struct B(f32); #[derive(Copy, Clone, Debug, PartialEq)] struct C(f32); #[derive(Copy, Clone, Debug, PartialEq)] struct D(f32); let mut world = crate::internals::world::World::new(WorldOptions { groups: vec![<(A, B, C, D)>::to_group()], }); world.extend(std::iter::repeat((A(0f32),)).take(10000)); world.extend(std::iter::repeat((A(0f32), B(1f32))).take(10000)); world.extend(std::iter::repeat((A(0f32), B(1f32), C(2f32))).take(10000)); world.extend(std::iter::repeat((A(0f32), B(1f32), C(2f32), D(3f32))).take(10000)); world.pack(PackOptions::force()); let mut query = <(Read<A>, Write<B>)>::query(); assert_eq!(query.iter_mut(&mut world).count(), 30000); let mut count = 0; for chunk in query.iter_chunks_mut(&mut world) { count += chunk.into_iter().count(); } assert_eq!(count, 30000); let mut count = 0; for chunk in query.iter_chunks_mut(&mut world) { let (x, _) = chunk.into_components(); count += x.iter().count(); } assert_eq!(count, 30000); } #[test] fn move_from() { let mut a = World::default(); let mut b = World::default(); let entity_a = a.extend(vec![ (Pos(1., 2., 3.), Rot(0.1, 0.2, 0.3)), (Pos(4., 5., 6.), Rot(0.4, 0.5, 0.6)), ])[0]; let entity_b = b.extend(vec![ (Pos(7., 8., 9.), Rot(0.7, 0.8, 0.9)), (Pos(10., 11., 12.), Rot(0.10, 0.11, 0.12)), ])[0]; b.move_from(&mut a, &any()); assert!(a.entry(entity_a).is_none()); assert_eq!( *b.entry(entity_b).unwrap().get_component::<Pos>().unwrap(), Pos(7., 8., 9.) ); assert_eq!( *b.entry(entity_a).unwrap().get_component::<Pos>().unwrap(), Pos(1., 2., 3.) ); } #[test] fn clone_from() { let mut a = World::default(); let mut b = World::default(); let entity_a = a.extend(vec![ (Pos(1., 2., 3.), Rot(0.1, 0.2, 0.3)), (Pos(4., 5., 6.), Rot(0.4, 0.5, 0.6)), ])[0]; let entity_b = b.extend(vec![ (Pos(7., 8., 9.), Rot(0.7, 0.8, 0.9)), (Pos(10., 11., 12.), Rot(0.10, 0.11, 0.12)), ])[0]; let mut merger = Duplicate::default(); merger.register_copy::<Pos>(); merger.register_clone::<Rot>(); let map = b.clone_from(&a, &any(), &mut merger); assert_eq!( *a.entry(entity_a).unwrap().get_component::<Pos>().unwrap(), Pos(1., 2., 3.) ); assert_eq!( *b.entry(map[&entity_a]) .unwrap() .get_component::<Pos>() .unwrap(), Pos(1., 2., 3.) ); assert_eq!( *b.entry(entity_b).unwrap().get_component::<Pos>().unwrap(), Pos(7., 8., 9.) ); assert_eq!( *a.entry(entity_a).unwrap().get_component::<Rot>().unwrap(), Rot(0.1, 0.2, 0.3) ); assert_eq!( *b.entry(map[&entity_a]) .unwrap() .get_component::<Rot>() .unwrap(), Rot(0.1, 0.2, 0.3) ); assert_eq!( *b.entry(entity_b).unwrap().get_component::<Rot>().unwrap(), Rot(0.7, 0.8, 0.9) ); } #[test] fn clone_update_entity_refs() { let mut a = World::default(); let mut b = World::default(); let entity_1 = a.push((Pos(1., 2., 3.), Rot(0.1, 0.2, 0.3))); let entity_2 = a.push((Pos(4., 5., 6.), Rot(0.4, 0.5, 0.6), entity_1)); a.entry(entity_1).unwrap().add_component(entity_2); b.extend(vec![ (Pos(7., 8., 9.), Rot(0.7, 0.8, 0.9)), (Pos(10., 11., 12.), Rot(0.10, 0.11, 0.12)), ]); let mut merger = Duplicate::default(); merger.register_copy::<Pos>(); merger.register_clone::<Rot>(); merger.register_clone::<Entity>(); let map = b.clone_from(&a, &any(), &mut merger); assert_eq!( *b.entry(map[&entity_1]) .unwrap() .get_component::<Entity>() .unwrap(), map[&entity_2] ); assert_eq!( *b.entry(map[&entity_2]) .unwrap() .get_component::<Entity>() .unwrap(), map[&entity_1] ); } #[test] fn clone_from_single() { let mut a = World::default(); let mut b = World::default(); let entities = a .extend(vec![ (Pos(1., 2., 3.), Rot(0.1, 0.2, 0.3)), (Pos(4., 5., 6.), Rot(0.4, 0.5, 0.6)), ]) .to_vec(); let entity_b = b.extend(vec![ (Pos(7., 8., 9.), Rot(0.7, 0.8, 0.9)), (Pos(10., 11., 12.), Rot(0.10, 0.11, 0.12)), ])[0]; let mut merger = Duplicate::default(); merger.register_copy::<Pos>(); merger.register_clone::<Rot>(); let cloned = b.clone_from_single(&a, entities[0], &mut merger); assert_eq!( *a.entry(entities[0]) .unwrap() .get_component::<Pos>() .unwrap(), Pos(1., 2., 3.) ); assert_eq!( *b.entry(cloned).unwrap().get_component::<Pos>().unwrap(), Pos(1., 2., 3.) ); assert_eq!( *b.entry(entity_b).unwrap().get_component::<Pos>().unwrap(), Pos(7., 8., 9.) ); assert_eq!( *a.entry(entities[0]) .unwrap() .get_component::<Rot>() .unwrap(), Rot(0.1, 0.2, 0.3) ); assert_eq!( *b.entry(cloned).unwrap().get_component::<Rot>().unwrap(), Rot(0.1, 0.2, 0.3) ); assert_eq!( *b.entry(entity_b).unwrap().get_component::<Rot>().unwrap(), Rot(0.7, 0.8, 0.9) ); assert!(a.entry(entities[1]).is_some()); assert!(b.entry(entities[1]).is_none()); } #[test] #[allow(clippy::float_cmp)] fn clone_from_convert() { let mut a = World::default(); let mut b = World::default(); let entity_a = a.extend(vec![ (Pos(1., 2., 3.), Rot(0.1, 0.2, 0.3)), (Pos(4., 5., 6.), Rot(0.4, 0.5, 0.6)), ])[0]; b.extend(vec![ (Pos(7., 8., 9.), Rot(0.7, 0.8, 0.9)), (Pos(10., 11., 12.), Rot(0.10, 0.11, 0.12)), ]); let mut merger = Duplicate::default(); merger.register_convert::<Pos, f32, _>(|comp| comp.0 as f32); let map = b.clone_from(&a, &any(), &mut merger); assert_eq!( *a.entry(entity_a).unwrap().get_component::<Pos>().unwrap(), Pos(1., 2., 3.) ); assert_eq!( *b.entry(map[&entity_a]) .unwrap() .get_component::<f32>() .unwrap(), 1f32 ); assert_eq!( *a.entry(entity_a).unwrap().get_component::<Rot>().unwrap(), Rot(0.1, 0.2, 0.3) ); assert!(b .entry(map[&entity_a]) .unwrap() .get_component::<Rot>() .is_err()); } }
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn parse_http_generic_error( response: &http::Response<bytes::Bytes>, ) -> Result<smithy_types::Error, smithy_json::deserialize::Error> { crate::json_errors::parse_generic_error(response.body(), response.headers()) } pub fn deser_structure_bad_request_exceptionjson_err( input: &[u8], mut builder: crate::error::bad_request_exception::Builder, ) -> Result<crate::error::bad_request_exception::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_conflict_exceptionjson_err( input: &[u8], mut builder: crate::error::conflict_exception::Builder, ) -> Result<crate::error::conflict_exception::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_forbidden_exceptionjson_err( input: &[u8], mut builder: crate::error::forbidden_exception::Builder, ) -> Result<crate::error::forbidden_exception::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_internal_server_error_exceptionjson_err( input: &[u8], mut builder: crate::error::internal_server_error_exception::Builder, ) -> Result<crate::error::internal_server_error_exception::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_not_found_exceptionjson_err( input: &[u8], mut builder: crate::error::not_found_exception::Builder, ) -> Result<crate::error::not_found_exception::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_too_many_requests_exceptionjson_err( input: &[u8], mut builder: crate::error::too_many_requests_exception::Builder, ) -> Result<crate::error::too_many_requests_exception::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_create_job( input: &[u8], mut builder: crate::output::create_job_output::Builder, ) -> Result<crate::output::create_job_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "job" => { builder = builder.set_job(crate::json_deser::deser_structure_job(tokens)?); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_create_job_template( input: &[u8], mut builder: crate::output::create_job_template_output::Builder, ) -> Result<crate::output::create_job_template_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "jobTemplate" => { builder = builder.set_job_template( crate::json_deser::deser_structure_job_template(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_create_preset( input: &[u8], mut builder: crate::output::create_preset_output::Builder, ) -> Result<crate::output::create_preset_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "preset" => { builder = builder.set_preset(crate::json_deser::deser_structure_preset(tokens)?); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_create_queue( input: &[u8], mut builder: crate::output::create_queue_output::Builder, ) -> Result<crate::output::create_queue_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "queue" => { builder = builder.set_queue(crate::json_deser::deser_structure_queue(tokens)?); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_describe_endpoints( input: &[u8], mut builder: crate::output::describe_endpoints_output::Builder, ) -> Result<crate::output::describe_endpoints_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "endpoints" => { builder = builder.set_endpoints( crate::json_deser::deser_list___list_of_endpoint(tokens)?, ); } "nextToken" => { builder = builder.set_next_token( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_get_job( input: &[u8], mut builder: crate::output::get_job_output::Builder, ) -> Result<crate::output::get_job_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "job" => { builder = builder.set_job(crate::json_deser::deser_structure_job(tokens)?); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_get_job_template( input: &[u8], mut builder: crate::output::get_job_template_output::Builder, ) -> Result<crate::output::get_job_template_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "jobTemplate" => { builder = builder.set_job_template( crate::json_deser::deser_structure_job_template(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_get_preset( input: &[u8], mut builder: crate::output::get_preset_output::Builder, ) -> Result<crate::output::get_preset_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "preset" => { builder = builder.set_preset(crate::json_deser::deser_structure_preset(tokens)?); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_get_queue( input: &[u8], mut builder: crate::output::get_queue_output::Builder, ) -> Result<crate::output::get_queue_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "queue" => { builder = builder.set_queue(crate::json_deser::deser_structure_queue(tokens)?); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_list_jobs( input: &[u8], mut builder: crate::output::list_jobs_output::Builder, ) -> Result<crate::output::list_jobs_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "jobs" => { builder = builder.set_jobs(crate::json_deser::deser_list___list_of_job(tokens)?); } "nextToken" => { builder = builder.set_next_token( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_list_job_templates( input: &[u8], mut builder: crate::output::list_job_templates_output::Builder, ) -> Result<crate::output::list_job_templates_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "jobTemplates" => { builder = builder.set_job_templates( crate::json_deser::deser_list___list_of_job_template(tokens)?, ); } "nextToken" => { builder = builder.set_next_token( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_list_presets( input: &[u8], mut builder: crate::output::list_presets_output::Builder, ) -> Result<crate::output::list_presets_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "nextToken" => { builder = builder.set_next_token( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "presets" => { builder = builder .set_presets(crate::json_deser::deser_list___list_of_preset(tokens)?); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_list_queues( input: &[u8], mut builder: crate::output::list_queues_output::Builder, ) -> Result<crate::output::list_queues_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "nextToken" => { builder = builder.set_next_token( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "queues" => { builder = builder .set_queues(crate::json_deser::deser_list___list_of_queue(tokens)?); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_list_tags_for_resource( input: &[u8], mut builder: crate::output::list_tags_for_resource_output::Builder, ) -> Result<crate::output::list_tags_for_resource_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "resourceTags" => { builder = builder.set_resource_tags( crate::json_deser::deser_structure_resource_tags(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_update_job_template( input: &[u8], mut builder: crate::output::update_job_template_output::Builder, ) -> Result<crate::output::update_job_template_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "jobTemplate" => { builder = builder.set_job_template( crate::json_deser::deser_structure_job_template(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_update_preset( input: &[u8], mut builder: crate::output::update_preset_output::Builder, ) -> Result<crate::output::update_preset_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "preset" => { builder = builder.set_preset(crate::json_deser::deser_structure_preset(tokens)?); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_update_queue( input: &[u8], mut builder: crate::output::update_queue_output::Builder, ) -> Result<crate::output::update_queue_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "queue" => { builder = builder.set_queue(crate::json_deser::deser_structure_queue(tokens)?); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn or_empty_doc(data: &[u8]) -> &[u8] { if data.is_empty() { b"{}" } else { data } } pub fn deser_structure_job<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Job>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Job::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "accelerationSettings" => { builder = builder.set_acceleration_settings( crate::json_deser::deser_structure_acceleration_settings( tokens, )?, ); } "accelerationStatus" => { builder = builder.set_acceleration_status( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AccelerationStatus::from(u.as_ref()) }) }) .transpose()?, ); } "arn" => { builder = builder.set_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "billingTagsSource" => { builder = builder.set_billing_tags_source( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::BillingTagsSource::from(u.as_ref()) }) }) .transpose()?, ); } "createdAt" => { builder = builder.set_created_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "currentPhase" => { builder = builder.set_current_phase( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::JobPhase::from(u.as_ref())) }) .transpose()?, ); } "errorCode" => { builder = builder.set_error_code( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "errorMessage" => { builder = builder.set_error_message( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "hopDestinations" => { builder = builder.set_hop_destinations( crate::json_deser::deser_list___list_of_hop_destination( tokens, )?, ); } "id" => { builder = builder.set_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "jobPercentComplete" => { builder = builder.set_job_percent_complete( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "jobTemplate" => { builder = builder.set_job_template( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "messages" => { builder = builder.set_messages( crate::json_deser::deser_structure_job_messages(tokens)?, ); } "outputGroupDetails" => { builder = builder.set_output_group_details( crate::json_deser::deser_list___list_of_output_group_detail( tokens, )?, ); } "priority" => { builder = builder.set_priority( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "queue" => { builder = builder.set_queue( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "queueTransitions" => { builder = builder.set_queue_transitions( crate::json_deser::deser_list___list_of_queue_transition( tokens, )?, ); } "retryCount" => { builder = builder.set_retry_count( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "role" => { builder = builder.set_role( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "settings" => { builder = builder.set_settings( crate::json_deser::deser_structure_job_settings(tokens)?, ); } "simulateReservedQueue" => { builder = builder.set_simulate_reserved_queue( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::SimulateReservedQueue::from(u.as_ref()) }) }) .transpose()?, ); } "status" => { builder = builder.set_status( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::JobStatus::from(u.as_ref())) }) .transpose()?, ); } "statusUpdateInterval" => { builder = builder.set_status_update_interval( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::StatusUpdateInterval::from(u.as_ref()) }) }) .transpose()?, ); } "timing" => { builder = builder .set_timing(crate::json_deser::deser_structure_timing(tokens)?); } "userMetadata" => { builder = builder.set_user_metadata( crate::json_deser::deser_map___map_of__string(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_job_template<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::JobTemplate>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::JobTemplate::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "accelerationSettings" => { builder = builder.set_acceleration_settings( crate::json_deser::deser_structure_acceleration_settings( tokens, )?, ); } "arn" => { builder = builder.set_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "category" => { builder = builder.set_category( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "createdAt" => { builder = builder.set_created_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "description" => { builder = builder.set_description( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "hopDestinations" => { builder = builder.set_hop_destinations( crate::json_deser::deser_list___list_of_hop_destination( tokens, )?, ); } "lastUpdated" => { builder = builder.set_last_updated( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "priority" => { builder = builder.set_priority( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "queue" => { builder = builder.set_queue( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "settings" => { builder = builder.set_settings( crate::json_deser::deser_structure_job_template_settings( tokens, )?, ); } "statusUpdateInterval" => { builder = builder.set_status_update_interval( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::StatusUpdateInterval::from(u.as_ref()) }) }) .transpose()?, ); } "type" => { builder = builder.set_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Type::from(u.as_ref())) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_preset<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Preset>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Preset::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "arn" => { builder = builder.set_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "category" => { builder = builder.set_category( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "createdAt" => { builder = builder.set_created_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "description" => { builder = builder.set_description( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "lastUpdated" => { builder = builder.set_last_updated( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "settings" => { builder = builder.set_settings( crate::json_deser::deser_structure_preset_settings(tokens)?, ); } "type" => { builder = builder.set_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Type::from(u.as_ref())) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_queue<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Queue>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Queue::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "arn" => { builder = builder.set_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "createdAt" => { builder = builder.set_created_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "description" => { builder = builder.set_description( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "lastUpdated" => { builder = builder.set_last_updated( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "pricingPlan" => { builder = builder.set_pricing_plan( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::PricingPlan::from(u.as_ref())) }) .transpose()?, ); } "progressingJobsCount" => { builder = builder.set_progressing_jobs_count( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "reservationPlan" => { builder = builder.set_reservation_plan( crate::json_deser::deser_structure_reservation_plan(tokens)?, ); } "status" => { builder = builder.set_status( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::QueueStatus::from(u.as_ref())) }) .transpose()?, ); } "submittedJobsCount" => { builder = builder.set_submitted_jobs_count( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "type" => { builder = builder.set_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Type::from(u.as_ref())) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_endpoint<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::Endpoint>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_endpoint(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_job<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::Job>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_job(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_job_template<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::JobTemplate>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_job_template(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_preset<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::Preset>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_preset(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_queue<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::Queue>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_queue(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_resource_tags<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ResourceTags>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ResourceTags::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "arn" => { builder = builder.set_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "tags" => { builder = builder.set_tags( crate::json_deser::deser_map___map_of__string(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_acceleration_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AccelerationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AccelerationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "mode" => { builder = builder.set_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AccelerationMode::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_hop_destination<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::HopDestination>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_hop_destination(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_job_messages<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::JobMessages>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::JobMessages::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "info" => { builder = builder.set_info( crate::json_deser::deser_list___list_of__string(tokens)?, ); } "warning" => { builder = builder.set_warning( crate::json_deser::deser_list___list_of__string(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_output_group_detail<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::OutputGroupDetail>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_output_group_detail(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_queue_transition<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::QueueTransition>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_queue_transition(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_job_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::JobSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::JobSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "adAvailOffset" => { builder = builder.set_ad_avail_offset( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "availBlanking" => { builder = builder.set_avail_blanking( crate::json_deser::deser_structure_avail_blanking(tokens)?, ); } "esam" => { builder = builder.set_esam( crate::json_deser::deser_structure_esam_settings(tokens)?, ); } "extendedDataServices" => { builder = builder.set_extended_data_services( crate::json_deser::deser_structure_extended_data_services( tokens, )?, ); } "inputs" => { builder = builder.set_inputs( crate::json_deser::deser_list___list_of_input(tokens)?, ); } "kantarWatermark" => { builder = builder.set_kantar_watermark( crate::json_deser::deser_structure_kantar_watermark_settings( tokens, )?, ); } "motionImageInserter" => { builder = builder.set_motion_image_inserter( crate::json_deser::deser_structure_motion_image_inserter( tokens, )?, ); } "nielsenConfiguration" => { builder = builder.set_nielsen_configuration( crate::json_deser::deser_structure_nielsen_configuration( tokens, )?, ); } "nielsenNonLinearWatermark" => { builder = builder.set_nielsen_non_linear_watermark( crate::json_deser::deser_structure_nielsen_non_linear_watermark_settings(tokens)? ); } "outputGroups" => { builder = builder.set_output_groups( crate::json_deser::deser_list___list_of_output_group(tokens)?, ); } "timecodeConfig" => { builder = builder.set_timecode_config( crate::json_deser::deser_structure_timecode_config(tokens)?, ); } "timedMetadataInsertion" => { builder = builder.set_timed_metadata_insertion( crate::json_deser::deser_structure_timed_metadata_insertion( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_timing<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Timing>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Timing::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "finishTime" => { builder = builder.set_finish_time( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "startTime" => { builder = builder.set_start_time( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "submitTime" => { builder = builder.set_submit_time( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_map___map_of__string<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::collections::HashMap<std::string::String, std::string::String>>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { let mut map = std::collections::HashMap::new(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { let key = key.to_unescaped().map(|u| u.into_owned())?; let value = smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?; if let Some(value) = value { map.insert(key, value); } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(map)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_job_template_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::JobTemplateSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::JobTemplateSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "adAvailOffset" => { builder = builder.set_ad_avail_offset( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "availBlanking" => { builder = builder.set_avail_blanking( crate::json_deser::deser_structure_avail_blanking(tokens)?, ); } "esam" => { builder = builder.set_esam( crate::json_deser::deser_structure_esam_settings(tokens)?, ); } "extendedDataServices" => { builder = builder.set_extended_data_services( crate::json_deser::deser_structure_extended_data_services( tokens, )?, ); } "inputs" => { builder = builder.set_inputs( crate::json_deser::deser_list___list_of_input_template(tokens)?, ); } "kantarWatermark" => { builder = builder.set_kantar_watermark( crate::json_deser::deser_structure_kantar_watermark_settings( tokens, )?, ); } "motionImageInserter" => { builder = builder.set_motion_image_inserter( crate::json_deser::deser_structure_motion_image_inserter( tokens, )?, ); } "nielsenConfiguration" => { builder = builder.set_nielsen_configuration( crate::json_deser::deser_structure_nielsen_configuration( tokens, )?, ); } "nielsenNonLinearWatermark" => { builder = builder.set_nielsen_non_linear_watermark( crate::json_deser::deser_structure_nielsen_non_linear_watermark_settings(tokens)? ); } "outputGroups" => { builder = builder.set_output_groups( crate::json_deser::deser_list___list_of_output_group(tokens)?, ); } "timecodeConfig" => { builder = builder.set_timecode_config( crate::json_deser::deser_structure_timecode_config(tokens)?, ); } "timedMetadataInsertion" => { builder = builder.set_timed_metadata_insertion( crate::json_deser::deser_structure_timed_metadata_insertion( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_preset_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::PresetSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::PresetSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "audioDescriptions" => { builder = builder.set_audio_descriptions( crate::json_deser::deser_list___list_of_audio_description( tokens, )?, ); } "captionDescriptions" => { builder = builder.set_caption_descriptions( crate::json_deser::deser_list___list_of_caption_description_preset(tokens)? ); } "containerSettings" => { builder = builder.set_container_settings( crate::json_deser::deser_structure_container_settings(tokens)?, ); } "videoDescription" => { builder = builder.set_video_description( crate::json_deser::deser_structure_video_description(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_reservation_plan<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ReservationPlan>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ReservationPlan::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "commitment" => { builder = builder.set_commitment( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Commitment::from(u.as_ref())) }) .transpose()?, ); } "expiresAt" => { builder = builder.set_expires_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "purchasedAt" => { builder = builder.set_purchased_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "renewalType" => { builder = builder.set_renewal_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::RenewalType::from(u.as_ref())) }) .transpose()?, ); } "reservedSlots" => { builder = builder.set_reserved_slots( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "status" => { builder = builder.set_status( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ReservationPlanStatus::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_endpoint<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Endpoint>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Endpoint::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "url" => { builder = builder.set_url( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_hop_destination<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::HopDestination>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::HopDestination::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "priority" => { builder = builder.set_priority( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "queue" => { builder = builder.set_queue( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "waitMinutes" => { builder = builder.set_wait_minutes( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of__string<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<std::string::String>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_output_group_detail<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::OutputGroupDetail>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::OutputGroupDetail::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "outputDetails" => { builder = builder.set_output_details( crate::json_deser::deser_list___list_of_output_detail(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_queue_transition<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::QueueTransition>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::QueueTransition::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "destinationQueue" => { builder = builder.set_destination_queue( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "sourceQueue" => { builder = builder.set_source_queue( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "timestamp" => { builder = builder.set_timestamp( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_avail_blanking<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AvailBlanking>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AvailBlanking::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "availBlankingImage" => { builder = builder.set_avail_blanking_image( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_esam_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::EsamSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::EsamSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "manifestConfirmConditionNotification" => { builder = builder.set_manifest_confirm_condition_notification( crate::json_deser::deser_structure_esam_manifest_confirm_condition_notification(tokens)? ); } "responseSignalPreroll" => { builder = builder.set_response_signal_preroll( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "signalProcessingNotification" => { builder = builder.set_signal_processing_notification( crate::json_deser::deser_structure_esam_signal_processing_notification(tokens)? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_extended_data_services<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ExtendedDataServices>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ExtendedDataServices::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "copyProtectionAction" => { builder = builder.set_copy_protection_action( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CopyProtectionAction::from(u.as_ref()) }) }) .transpose()?, ); } "vchipAction" => { builder = builder.set_vchip_action( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::VchipAction::from(u.as_ref())) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_input<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::Input>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_input(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_kantar_watermark_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::KantarWatermarkSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::KantarWatermarkSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "channelName" => { builder = builder.set_channel_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "contentReference" => { builder = builder.set_content_reference( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "credentialsSecretName" => { builder = builder.set_credentials_secret_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "fileOffset" => { builder = builder.set_file_offset( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "kantarLicenseId" => { builder = builder.set_kantar_license_id( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "kantarServerUrl" => { builder = builder.set_kantar_server_url( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "logDestination" => { builder = builder.set_log_destination( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "metadata3" => { builder = builder.set_metadata3( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "metadata4" => { builder = builder.set_metadata4( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "metadata5" => { builder = builder.set_metadata5( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "metadata6" => { builder = builder.set_metadata6( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "metadata7" => { builder = builder.set_metadata7( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "metadata8" => { builder = builder.set_metadata8( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_motion_image_inserter<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::MotionImageInserter>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::MotionImageInserter::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "framerate" => { builder = builder.set_framerate( crate::json_deser::deser_structure_motion_image_insertion_framerate(tokens)? ); } "input" => { builder = builder.set_input( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "insertionMode" => { builder = builder.set_insertion_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::MotionImageInsertionMode::from(u.as_ref()) }) }) .transpose()?, ); } "offset" => { builder = builder.set_offset( crate::json_deser::deser_structure_motion_image_insertion_offset(tokens)? ); } "playback" => { builder = builder.set_playback( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::MotionImagePlayback::from(u.as_ref()) }) }) .transpose()?, ); } "startTime" => { builder = builder.set_start_time( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_nielsen_configuration<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::NielsenConfiguration>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::NielsenConfiguration::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "breakoutCode" => { builder = builder.set_breakout_code( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "distributorId" => { builder = builder.set_distributor_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_nielsen_non_linear_watermark_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::NielsenNonLinearWatermarkSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::NielsenNonLinearWatermarkSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "activeWatermarkProcess" => { builder = builder.set_active_watermark_process( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::NielsenActiveWatermarkProcessType::from( u.as_ref(), ) }) }) .transpose()?, ); } "adiFilename" => { builder = builder.set_adi_filename( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "assetId" => { builder = builder.set_asset_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "assetName" => { builder = builder.set_asset_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cbetSourceId" => { builder = builder.set_cbet_source_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "episodeId" => { builder = builder.set_episode_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "metadataDestination" => { builder = builder.set_metadata_destination( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "sourceId" => { builder = builder.set_source_id( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "sourceWatermarkStatus" => { builder = builder.set_source_watermark_status( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::NielsenSourceWatermarkStatusType::from( u.as_ref(), ) }) }) .transpose()?, ); } "ticServerUrl" => { builder = builder.set_tic_server_url( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "uniqueTicPerAudioTrack" => { builder = builder.set_unique_tic_per_audio_track( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::NielsenUniqueTicPerAudioTrackType::from( u.as_ref(), ) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_output_group<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::OutputGroup>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_output_group(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_timecode_config<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TimecodeConfig>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TimecodeConfig::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "anchor" => { builder = builder.set_anchor( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "source" => { builder = builder.set_source( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::TimecodeSource::from(u.as_ref())) }) .transpose()?, ); } "start" => { builder = builder.set_start( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "timestampOffset" => { builder = builder.set_timestamp_offset( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_timed_metadata_insertion<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TimedMetadataInsertion>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TimedMetadataInsertion::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "id3Insertions" => { builder = builder.set_id3_insertions( crate::json_deser::deser_list___list_of_id3_insertion(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_input_template<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::InputTemplate>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_input_template(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_audio_description<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::AudioDescription>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_audio_description(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_caption_description_preset<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::vec::Vec<crate::model::CaptionDescriptionPreset>>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_caption_description_preset(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_container_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ContainerSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ContainerSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "cmfcSettings" => { builder = builder.set_cmfc_settings( crate::json_deser::deser_structure_cmfc_settings(tokens)?, ); } "container" => { builder = builder.set_container( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::ContainerType::from(u.as_ref())) }) .transpose()?, ); } "f4vSettings" => { builder = builder.set_f4v_settings( crate::json_deser::deser_structure_f4v_settings(tokens)?, ); } "m2tsSettings" => { builder = builder.set_m2ts_settings( crate::json_deser::deser_structure_m2ts_settings(tokens)?, ); } "m3u8Settings" => { builder = builder.set_m3u8_settings( crate::json_deser::deser_structure_m3u8_settings(tokens)?, ); } "movSettings" => { builder = builder.set_mov_settings( crate::json_deser::deser_structure_mov_settings(tokens)?, ); } "mp4Settings" => { builder = builder.set_mp4_settings( crate::json_deser::deser_structure_mp4_settings(tokens)?, ); } "mpdSettings" => { builder = builder.set_mpd_settings( crate::json_deser::deser_structure_mpd_settings(tokens)?, ); } "mxfSettings" => { builder = builder.set_mxf_settings( crate::json_deser::deser_structure_mxf_settings(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_video_description<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::VideoDescription>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::VideoDescription::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "afdSignaling" => { builder = builder.set_afd_signaling( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::AfdSignaling::from(u.as_ref())) }) .transpose()?, ); } "antiAlias" => { builder = builder.set_anti_alias( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::AntiAlias::from(u.as_ref())) }) .transpose()?, ); } "codecSettings" => { builder = builder.set_codec_settings( crate::json_deser::deser_structure_video_codec_settings( tokens, )?, ); } "colorMetadata" => { builder = builder.set_color_metadata( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::ColorMetadata::from(u.as_ref())) }) .transpose()?, ); } "crop" => { builder = builder.set_crop( crate::json_deser::deser_structure_rectangle(tokens)?, ); } "dropFrameTimecode" => { builder = builder.set_drop_frame_timecode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DropFrameTimecode::from(u.as_ref()) }) }) .transpose()?, ); } "fixedAfd" => { builder = builder.set_fixed_afd( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "height" => { builder = builder.set_height( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "position" => { builder = builder.set_position( crate::json_deser::deser_structure_rectangle(tokens)?, ); } "respondToAfd" => { builder = builder.set_respond_to_afd( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::RespondToAfd::from(u.as_ref())) }) .transpose()?, ); } "scalingBehavior" => { builder = builder.set_scaling_behavior( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ScalingBehavior::from(u.as_ref()) }) }) .transpose()?, ); } "sharpness" => { builder = builder.set_sharpness( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "timecodeInsertion" => { builder = builder.set_timecode_insertion( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::VideoTimecodeInsertion::from(u.as_ref()) }) }) .transpose()?, ); } "videoPreprocessors" => { builder = builder.set_video_preprocessors( crate::json_deser::deser_structure_video_preprocessor(tokens)?, ); } "width" => { builder = builder.set_width( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_output_detail<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::OutputDetail>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_output_detail(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_esam_manifest_confirm_condition_notification<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<crate::model::EsamManifestConfirmConditionNotification>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::EsamManifestConfirmConditionNotification::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "mccXml" => { builder = builder.set_mcc_xml( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_esam_signal_processing_notification<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::EsamSignalProcessingNotification>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::EsamSignalProcessingNotification::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "sccXml" => { builder = builder.set_scc_xml( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_input<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Input>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Input::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "audioSelectorGroups" => { builder = builder.set_audio_selector_groups( crate::json_deser::deser_map___map_of_audio_selector_group( tokens, )?, ); } "audioSelectors" => { builder = builder.set_audio_selectors( crate::json_deser::deser_map___map_of_audio_selector(tokens)?, ); } "captionSelectors" => { builder = builder.set_caption_selectors( crate::json_deser::deser_map___map_of_caption_selector(tokens)?, ); } "crop" => { builder = builder.set_crop( crate::json_deser::deser_structure_rectangle(tokens)?, ); } "deblockFilter" => { builder = builder.set_deblock_filter( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::InputDeblockFilter::from(u.as_ref()) }) }) .transpose()?, ); } "decryptionSettings" => { builder = builder.set_decryption_settings( crate::json_deser::deser_structure_input_decryption_settings( tokens, )?, ); } "denoiseFilter" => { builder = builder.set_denoise_filter( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::InputDenoiseFilter::from(u.as_ref()) }) }) .transpose()?, ); } "fileInput" => { builder = builder.set_file_input( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "filterEnable" => { builder = builder.set_filter_enable( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::InputFilterEnable::from(u.as_ref()) }) }) .transpose()?, ); } "filterStrength" => { builder = builder.set_filter_strength( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "imageInserter" => { builder = builder.set_image_inserter( crate::json_deser::deser_structure_image_inserter(tokens)?, ); } "inputClippings" => { builder = builder.set_input_clippings( crate::json_deser::deser_list___list_of_input_clipping(tokens)?, ); } "inputScanType" => { builder = builder.set_input_scan_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::InputScanType::from(u.as_ref())) }) .transpose()?, ); } "position" => { builder = builder.set_position( crate::json_deser::deser_structure_rectangle(tokens)?, ); } "programNumber" => { builder = builder.set_program_number( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "psiControl" => { builder = builder.set_psi_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::InputPsiControl::from(u.as_ref()) }) }) .transpose()?, ); } "supplementalImps" => { builder = builder.set_supplemental_imps( crate::json_deser::deser_list___list_of__string_pattern_s3_assetmap_xml(tokens)? ); } "timecodeSource" => { builder = builder.set_timecode_source( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::InputTimecodeSource::from(u.as_ref()) }) }) .transpose()?, ); } "timecodeStart" => { builder = builder.set_timecode_start( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "videoSelector" => { builder = builder.set_video_selector( crate::json_deser::deser_structure_video_selector(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_motion_image_insertion_framerate<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::MotionImageInsertionFramerate>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::MotionImageInsertionFramerate::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "framerateDenominator" => { builder = builder.set_framerate_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateNumerator" => { builder = builder.set_framerate_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_motion_image_insertion_offset<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::MotionImageInsertionOffset>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::MotionImageInsertionOffset::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "imageX" => { builder = builder.set_image_x( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "imageY" => { builder = builder.set_image_y( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_output_group<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::OutputGroup>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::OutputGroup::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "automatedEncodingSettings" => { builder = builder.set_automated_encoding_settings( crate::json_deser::deser_structure_automated_encoding_settings( tokens, )?, ); } "customName" => { builder = builder.set_custom_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "outputGroupSettings" => { builder = builder.set_output_group_settings( crate::json_deser::deser_structure_output_group_settings( tokens, )?, ); } "outputs" => { builder = builder.set_outputs( crate::json_deser::deser_list___list_of_output(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_id3_insertion<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::Id3Insertion>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_id3_insertion(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_input_template<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::InputTemplate>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::InputTemplate::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "audioSelectorGroups" => { builder = builder.set_audio_selector_groups( crate::json_deser::deser_map___map_of_audio_selector_group( tokens, )?, ); } "audioSelectors" => { builder = builder.set_audio_selectors( crate::json_deser::deser_map___map_of_audio_selector(tokens)?, ); } "captionSelectors" => { builder = builder.set_caption_selectors( crate::json_deser::deser_map___map_of_caption_selector(tokens)?, ); } "crop" => { builder = builder.set_crop( crate::json_deser::deser_structure_rectangle(tokens)?, ); } "deblockFilter" => { builder = builder.set_deblock_filter( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::InputDeblockFilter::from(u.as_ref()) }) }) .transpose()?, ); } "denoiseFilter" => { builder = builder.set_denoise_filter( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::InputDenoiseFilter::from(u.as_ref()) }) }) .transpose()?, ); } "filterEnable" => { builder = builder.set_filter_enable( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::InputFilterEnable::from(u.as_ref()) }) }) .transpose()?, ); } "filterStrength" => { builder = builder.set_filter_strength( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "imageInserter" => { builder = builder.set_image_inserter( crate::json_deser::deser_structure_image_inserter(tokens)?, ); } "inputClippings" => { builder = builder.set_input_clippings( crate::json_deser::deser_list___list_of_input_clipping(tokens)?, ); } "inputScanType" => { builder = builder.set_input_scan_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::InputScanType::from(u.as_ref())) }) .transpose()?, ); } "position" => { builder = builder.set_position( crate::json_deser::deser_structure_rectangle(tokens)?, ); } "programNumber" => { builder = builder.set_program_number( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "psiControl" => { builder = builder.set_psi_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::InputPsiControl::from(u.as_ref()) }) }) .transpose()?, ); } "timecodeSource" => { builder = builder.set_timecode_source( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::InputTimecodeSource::from(u.as_ref()) }) }) .transpose()?, ); } "timecodeStart" => { builder = builder.set_timecode_start( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "videoSelector" => { builder = builder.set_video_selector( crate::json_deser::deser_structure_video_selector(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_audio_description<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AudioDescription>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AudioDescription::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "audioChannelTaggingSettings" => { builder = builder.set_audio_channel_tagging_settings( crate::json_deser::deser_structure_audio_channel_tagging_settings(tokens)? ); } "audioNormalizationSettings" => { builder = builder.set_audio_normalization_settings( crate::json_deser::deser_structure_audio_normalization_settings(tokens)? ); } "audioSourceName" => { builder = builder.set_audio_source_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "audioType" => { builder = builder.set_audio_type( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "audioTypeControl" => { builder = builder.set_audio_type_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AudioTypeControl::from(u.as_ref()) }) }) .transpose()?, ); } "codecSettings" => { builder = builder.set_codec_settings( crate::json_deser::deser_structure_audio_codec_settings( tokens, )?, ); } "customLanguageCode" => { builder = builder.set_custom_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "languageCode" => { builder = builder.set_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::LanguageCode::from(u.as_ref())) }) .transpose()?, ); } "languageCodeControl" => { builder = builder.set_language_code_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AudioLanguageCodeControl::from(u.as_ref()) }) }) .transpose()?, ); } "remixSettings" => { builder = builder.set_remix_settings( crate::json_deser::deser_structure_remix_settings(tokens)?, ); } "streamName" => { builder = builder.set_stream_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_caption_description_preset<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::CaptionDescriptionPreset>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::CaptionDescriptionPreset::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "customLanguageCode" => { builder = builder.set_custom_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "destinationSettings" => { builder = builder.set_destination_settings( crate::json_deser::deser_structure_caption_destination_settings(tokens)? ); } "languageCode" => { builder = builder.set_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::LanguageCode::from(u.as_ref())) }) .transpose()?, ); } "languageDescription" => { builder = builder.set_language_description( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_cmfc_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::CmfcSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::CmfcSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "audioDuration" => { builder = builder.set_audio_duration( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmfcAudioDuration::from(u.as_ref()) }) }) .transpose()?, ); } "audioGroupId" => { builder = builder.set_audio_group_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "audioRenditionSets" => { builder = builder.set_audio_rendition_sets( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "audioTrackType" => { builder = builder.set_audio_track_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmfcAudioTrackType::from(u.as_ref()) }) }) .transpose()?, ); } "descriptiveVideoServiceFlag" => { builder = builder.set_descriptive_video_service_flag( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmfcDescriptiveVideoServiceFlag::from( u.as_ref(), ) }) }) .transpose()?, ); } "iFrameOnlyManifest" => { builder = builder.set_i_frame_only_manifest( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmfcIFrameOnlyManifest::from(u.as_ref()) }) }) .transpose()?, ); } "scte35Esam" => { builder = builder.set_scte35_esam( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::CmfcScte35Esam::from(u.as_ref())) }) .transpose()?, ); } "scte35Source" => { builder = builder.set_scte35_source( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmfcScte35Source::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_f4v_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::F4vSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::F4vSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "moovPlacement" => { builder = builder.set_moov_placement( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::F4vMoovPlacement::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_m2ts_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::M2tsSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::M2tsSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "audioBufferModel" => { builder = builder.set_audio_buffer_model( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M2tsAudioBufferModel::from(u.as_ref()) }) }) .transpose()?, ); } "audioDuration" => { builder = builder.set_audio_duration( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M2tsAudioDuration::from(u.as_ref()) }) }) .transpose()?, ); } "audioFramesPerPes" => { builder = builder.set_audio_frames_per_pes( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "audioPids" => { builder = builder.set_audio_pids( crate::json_deser::deser_list___list_of__integer_min32_max8182( tokens, )?, ); } "bitrate" => { builder = builder.set_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "bufferModel" => { builder = builder.set_buffer_model( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M2tsBufferModel::from(u.as_ref()) }) }) .transpose()?, ); } "dataPTSControl" => { builder = builder.set_data_pts_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M2tsDataPtsControl::from(u.as_ref()) }) }) .transpose()?, ); } "dvbNitSettings" => { builder = builder.set_dvb_nit_settings( crate::json_deser::deser_structure_dvb_nit_settings(tokens)?, ); } "dvbSdtSettings" => { builder = builder.set_dvb_sdt_settings( crate::json_deser::deser_structure_dvb_sdt_settings(tokens)?, ); } "dvbSubPids" => { builder = builder.set_dvb_sub_pids( crate::json_deser::deser_list___list_of__integer_min32_max8182( tokens, )?, ); } "dvbTdtSettings" => { builder = builder.set_dvb_tdt_settings( crate::json_deser::deser_structure_dvb_tdt_settings(tokens)?, ); } "dvbTeletextPid" => { builder = builder.set_dvb_teletext_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "ebpAudioInterval" => { builder = builder.set_ebp_audio_interval( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M2tsEbpAudioInterval::from(u.as_ref()) }) }) .transpose()?, ); } "ebpPlacement" => { builder = builder.set_ebp_placement( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M2tsEbpPlacement::from(u.as_ref()) }) }) .transpose()?, ); } "esRateInPes" => { builder = builder.set_es_rate_in_pes( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M2tsEsRateInPes::from(u.as_ref()) }) }) .transpose()?, ); } "forceTsVideoEbpOrder" => { builder = builder.set_force_ts_video_ebp_order( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M2tsForceTsVideoEbpOrder::from(u.as_ref()) }) }) .transpose()?, ); } "fragmentTime" => { builder = builder.set_fragment_time( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "maxPcrInterval" => { builder = builder.set_max_pcr_interval( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "minEbpInterval" => { builder = builder.set_min_ebp_interval( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "nielsenId3" => { builder = builder.set_nielsen_id3( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::M2tsNielsenId3::from(u.as_ref())) }) .transpose()?, ); } "nullPacketBitrate" => { builder = builder.set_null_packet_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "patInterval" => { builder = builder.set_pat_interval( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "pcrControl" => { builder = builder.set_pcr_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::M2tsPcrControl::from(u.as_ref())) }) .transpose()?, ); } "pcrPid" => { builder = builder.set_pcr_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "pmtInterval" => { builder = builder.set_pmt_interval( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "pmtPid" => { builder = builder.set_pmt_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "privateMetadataPid" => { builder = builder.set_private_metadata_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "programNumber" => { builder = builder.set_program_number( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "rateMode" => { builder = builder.set_rate_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::M2tsRateMode::from(u.as_ref())) }) .transpose()?, ); } "scte35Esam" => { builder = builder.set_scte35_esam( crate::json_deser::deser_structure_m2ts_scte35_esam(tokens)?, ); } "scte35Pid" => { builder = builder.set_scte35_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "scte35Source" => { builder = builder.set_scte35_source( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M2tsScte35Source::from(u.as_ref()) }) }) .transpose()?, ); } "segmentationMarkers" => { builder = builder.set_segmentation_markers( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M2tsSegmentationMarkers::from(u.as_ref()) }) }) .transpose()?, ); } "segmentationStyle" => { builder = builder.set_segmentation_style( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M2tsSegmentationStyle::from(u.as_ref()) }) }) .transpose()?, ); } "segmentationTime" => { builder = builder.set_segmentation_time( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "timedMetadataPid" => { builder = builder.set_timed_metadata_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "transportStreamId" => { builder = builder.set_transport_stream_id( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "videoPid" => { builder = builder.set_video_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_m3u8_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::M3u8Settings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::M3u8Settings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "audioDuration" => { builder = builder.set_audio_duration( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M3u8AudioDuration::from(u.as_ref()) }) }) .transpose()?, ); } "audioFramesPerPes" => { builder = builder.set_audio_frames_per_pes( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "audioPids" => { builder = builder.set_audio_pids( crate::json_deser::deser_list___list_of__integer_min32_max8182( tokens, )?, ); } "dataPTSControl" => { builder = builder.set_data_pts_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M3u8DataPtsControl::from(u.as_ref()) }) }) .transpose()?, ); } "maxPcrInterval" => { builder = builder.set_max_pcr_interval( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "nielsenId3" => { builder = builder.set_nielsen_id3( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::M3u8NielsenId3::from(u.as_ref())) }) .transpose()?, ); } "patInterval" => { builder = builder.set_pat_interval( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "pcrControl" => { builder = builder.set_pcr_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::M3u8PcrControl::from(u.as_ref())) }) .transpose()?, ); } "pcrPid" => { builder = builder.set_pcr_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "pmtInterval" => { builder = builder.set_pmt_interval( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "pmtPid" => { builder = builder.set_pmt_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "privateMetadataPid" => { builder = builder.set_private_metadata_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "programNumber" => { builder = builder.set_program_number( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "scte35Pid" => { builder = builder.set_scte35_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "scte35Source" => { builder = builder.set_scte35_source( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::M3u8Scte35Source::from(u.as_ref()) }) }) .transpose()?, ); } "timedMetadata" => { builder = builder.set_timed_metadata( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::TimedMetadata::from(u.as_ref())) }) .transpose()?, ); } "timedMetadataPid" => { builder = builder.set_timed_metadata_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "transportStreamId" => { builder = builder.set_transport_stream_id( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "videoPid" => { builder = builder.set_video_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_mov_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::MovSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::MovSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "clapAtom" => { builder = builder.set_clap_atom( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::MovClapAtom::from(u.as_ref())) }) .transpose()?, ); } "cslgAtom" => { builder = builder.set_cslg_atom( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::MovCslgAtom::from(u.as_ref())) }) .transpose()?, ); } "mpeg2FourCCControl" => { builder = builder.set_mpeg2_four_cc_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::MovMpeg2FourCcControl::from(u.as_ref()) }) }) .transpose()?, ); } "paddingControl" => { builder = builder.set_padding_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::MovPaddingControl::from(u.as_ref()) }) }) .transpose()?, ); } "reference" => { builder = builder.set_reference( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::MovReference::from(u.as_ref())) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_mp4_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Mp4Settings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Mp4Settings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "audioDuration" => { builder = builder.set_audio_duration( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmfcAudioDuration::from(u.as_ref()) }) }) .transpose()?, ); } "cslgAtom" => { builder = builder.set_cslg_atom( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Mp4CslgAtom::from(u.as_ref())) }) .transpose()?, ); } "cttsVersion" => { builder = builder.set_ctts_version( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "freeSpaceBox" => { builder = builder.set_free_space_box( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mp4FreeSpaceBox::from(u.as_ref()) }) }) .transpose()?, ); } "moovPlacement" => { builder = builder.set_moov_placement( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mp4MoovPlacement::from(u.as_ref()) }) }) .transpose()?, ); } "mp4MajorBrand" => { builder = builder.set_mp4_major_brand( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_mpd_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::MpdSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::MpdSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "accessibilityCaptionHints" => { builder = builder.set_accessibility_caption_hints( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::MpdAccessibilityCaptionHints::from( u.as_ref(), ) }) }) .transpose()?, ); } "audioDuration" => { builder = builder.set_audio_duration( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::MpdAudioDuration::from(u.as_ref()) }) }) .transpose()?, ); } "captionContainerType" => { builder = builder.set_caption_container_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::MpdCaptionContainerType::from(u.as_ref()) }) }) .transpose()?, ); } "scte35Esam" => { builder = builder.set_scte35_esam( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::MpdScte35Esam::from(u.as_ref())) }) .transpose()?, ); } "scte35Source" => { builder = builder.set_scte35_source( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::MpdScte35Source::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_mxf_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::MxfSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::MxfSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "afdSignaling" => { builder = builder.set_afd_signaling( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::MxfAfdSignaling::from(u.as_ref()) }) }) .transpose()?, ); } "profile" => { builder = builder.set_profile( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::MxfProfile::from(u.as_ref())) }) .transpose()?, ); } "xavcProfileSettings" => { builder = builder.set_xavc_profile_settings( crate::json_deser::deser_structure_mxf_xavc_profile_settings( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_video_codec_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::VideoCodecSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::VideoCodecSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "av1Settings" => { builder = builder.set_av1_settings( crate::json_deser::deser_structure_av1_settings(tokens)?, ); } "avcIntraSettings" => { builder = builder.set_avc_intra_settings( crate::json_deser::deser_structure_avc_intra_settings(tokens)?, ); } "codec" => { builder = builder.set_codec( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::VideoCodec::from(u.as_ref())) }) .transpose()?, ); } "frameCaptureSettings" => { builder = builder.set_frame_capture_settings( crate::json_deser::deser_structure_frame_capture_settings( tokens, )?, ); } "h264Settings" => { builder = builder.set_h264_settings( crate::json_deser::deser_structure_h264_settings(tokens)?, ); } "h265Settings" => { builder = builder.set_h265_settings( crate::json_deser::deser_structure_h265_settings(tokens)?, ); } "mpeg2Settings" => { builder = builder.set_mpeg2_settings( crate::json_deser::deser_structure_mpeg2_settings(tokens)?, ); } "proresSettings" => { builder = builder.set_prores_settings( crate::json_deser::deser_structure_prores_settings(tokens)?, ); } "vc3Settings" => { builder = builder.set_vc3_settings( crate::json_deser::deser_structure_vc3_settings(tokens)?, ); } "vp8Settings" => { builder = builder.set_vp8_settings( crate::json_deser::deser_structure_vp8_settings(tokens)?, ); } "vp9Settings" => { builder = builder.set_vp9_settings( crate::json_deser::deser_structure_vp9_settings(tokens)?, ); } "xavcSettings" => { builder = builder.set_xavc_settings( crate::json_deser::deser_structure_xavc_settings(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_rectangle<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Rectangle>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Rectangle::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "height" => { builder = builder.set_height( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "width" => { builder = builder.set_width( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "x" => { builder = builder.set_x( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "y" => { builder = builder.set_y( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_video_preprocessor<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::VideoPreprocessor>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::VideoPreprocessor::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "colorCorrector" => { builder = builder.set_color_corrector( crate::json_deser::deser_structure_color_corrector(tokens)?, ); } "deinterlacer" => { builder = builder.set_deinterlacer( crate::json_deser::deser_structure_deinterlacer(tokens)?, ); } "dolbyVision" => { builder = builder.set_dolby_vision( crate::json_deser::deser_structure_dolby_vision(tokens)?, ); } "hdr10Plus" => { builder = builder.set_hdr10_plus( crate::json_deser::deser_structure_hdr10_plus(tokens)?, ); } "imageInserter" => { builder = builder.set_image_inserter( crate::json_deser::deser_structure_image_inserter(tokens)?, ); } "noiseReducer" => { builder = builder.set_noise_reducer( crate::json_deser::deser_structure_noise_reducer(tokens)?, ); } "partnerWatermarking" => { builder = builder.set_partner_watermarking( crate::json_deser::deser_structure_partner_watermarking( tokens, )?, ); } "timecodeBurnin" => { builder = builder.set_timecode_burnin( crate::json_deser::deser_structure_timecode_burnin(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_output_detail<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::OutputDetail>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::OutputDetail::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "durationInMs" => { builder = builder.set_duration_in_ms( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "videoDetails" => { builder = builder.set_video_details( crate::json_deser::deser_structure_video_detail(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_map___map_of_audio_selector_group<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::collections::HashMap<std::string::String, crate::model::AudioSelectorGroup>>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { let mut map = std::collections::HashMap::new(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { let key = key.to_unescaped().map(|u| u.into_owned())?; let value = crate::json_deser::deser_structure_audio_selector_group(tokens)?; if let Some(value) = value { map.insert(key, value); } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(map)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_map___map_of_audio_selector<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::collections::HashMap<std::string::String, crate::model::AudioSelector>>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { let mut map = std::collections::HashMap::new(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { let key = key.to_unescaped().map(|u| u.into_owned())?; let value = crate::json_deser::deser_structure_audio_selector(tokens)?; if let Some(value) = value { map.insert(key, value); } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(map)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_map___map_of_caption_selector<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::collections::HashMap<std::string::String, crate::model::CaptionSelector>>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { let mut map = std::collections::HashMap::new(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { let key = key.to_unescaped().map(|u| u.into_owned())?; let value = crate::json_deser::deser_structure_caption_selector(tokens)?; if let Some(value) = value { map.insert(key, value); } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(map)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_input_decryption_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::InputDecryptionSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::InputDecryptionSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "decryptionMode" => { builder = builder.set_decryption_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::DecryptionMode::from(u.as_ref())) }) .transpose()?, ); } "encryptedDecryptionKey" => { builder = builder.set_encrypted_decryption_key( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "initializationVector" => { builder = builder.set_initialization_vector( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "kmsKeyRegion" => { builder = builder.set_kms_key_region( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_image_inserter<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ImageInserter>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ImageInserter::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "insertableImages" => { builder = builder.set_insertable_images( crate::json_deser::deser_list___list_of_insertable_image( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_input_clipping<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::InputClipping>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_input_clipping(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of__string_pattern_s3_assetmap_xml<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<std::string::String>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_video_selector<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::VideoSelector>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::VideoSelector::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "alphaBehavior" => { builder = builder.set_alpha_behavior( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::AlphaBehavior::from(u.as_ref())) }) .transpose()?, ); } "colorSpace" => { builder = builder.set_color_space( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::ColorSpace::from(u.as_ref())) }) .transpose()?, ); } "colorSpaceUsage" => { builder = builder.set_color_space_usage( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ColorSpaceUsage::from(u.as_ref()) }) }) .transpose()?, ); } "hdr10Metadata" => { builder = builder.set_hdr10_metadata( crate::json_deser::deser_structure_hdr10_metadata(tokens)?, ); } "pid" => { builder = builder.set_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "programNumber" => { builder = builder.set_program_number( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "rotate" => { builder = builder.set_rotate( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::InputRotate::from(u.as_ref())) }) .transpose()?, ); } "sampleRange" => { builder = builder.set_sample_range( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::InputSampleRange::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_automated_encoding_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AutomatedEncodingSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AutomatedEncodingSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "abrSettings" => { builder = builder.set_abr_settings( crate::json_deser::deser_structure_automated_abr_settings( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_output_group_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::OutputGroupSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::OutputGroupSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "cmafGroupSettings" => { builder = builder.set_cmaf_group_settings( crate::json_deser::deser_structure_cmaf_group_settings(tokens)?, ); } "dashIsoGroupSettings" => { builder = builder.set_dash_iso_group_settings( crate::json_deser::deser_structure_dash_iso_group_settings( tokens, )?, ); } "fileGroupSettings" => { builder = builder.set_file_group_settings( crate::json_deser::deser_structure_file_group_settings(tokens)?, ); } "hlsGroupSettings" => { builder = builder.set_hls_group_settings( crate::json_deser::deser_structure_hls_group_settings(tokens)?, ); } "msSmoothGroupSettings" => { builder = builder.set_ms_smooth_group_settings( crate::json_deser::deser_structure_ms_smooth_group_settings( tokens, )?, ); } "type" => { builder = builder.set_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::OutputGroupType::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_output<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::Output>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_output(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_id3_insertion<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Id3Insertion>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Id3Insertion::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "id3" => { builder = builder.set_id3( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "timecode" => { builder = builder.set_timecode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_audio_channel_tagging_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AudioChannelTaggingSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AudioChannelTaggingSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "channelTag" => { builder = builder.set_channel_tag( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AudioChannelTag::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_audio_normalization_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AudioNormalizationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AudioNormalizationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "algorithm" => { builder = builder.set_algorithm( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AudioNormalizationAlgorithm::from( u.as_ref(), ) }) }) .transpose()?, ); } "algorithmControl" => { builder = builder.set_algorithm_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AudioNormalizationAlgorithmControl::from( u.as_ref(), ) }) }) .transpose()?, ); } "correctionGateLevel" => { builder = builder.set_correction_gate_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "loudnessLogging" => { builder = builder.set_loudness_logging( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AudioNormalizationLoudnessLogging::from( u.as_ref(), ) }) }) .transpose()?, ); } "peakCalculation" => { builder = builder.set_peak_calculation( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AudioNormalizationPeakCalculation::from( u.as_ref(), ) }) }) .transpose()?, ); } "targetLkfs" => { builder = builder.set_target_lkfs( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_audio_codec_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AudioCodecSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AudioCodecSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "aacSettings" => { builder = builder.set_aac_settings( crate::json_deser::deser_structure_aac_settings(tokens)?, ); } "ac3Settings" => { builder = builder.set_ac3_settings( crate::json_deser::deser_structure_ac3_settings(tokens)?, ); } "aiffSettings" => { builder = builder.set_aiff_settings( crate::json_deser::deser_structure_aiff_settings(tokens)?, ); } "codec" => { builder = builder.set_codec( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::AudioCodec::from(u.as_ref())) }) .transpose()?, ); } "eac3AtmosSettings" => { builder = builder.set_eac3_atmos_settings( crate::json_deser::deser_structure_eac3_atmos_settings(tokens)?, ); } "eac3Settings" => { builder = builder.set_eac3_settings( crate::json_deser::deser_structure_eac3_settings(tokens)?, ); } "mp2Settings" => { builder = builder.set_mp2_settings( crate::json_deser::deser_structure_mp2_settings(tokens)?, ); } "mp3Settings" => { builder = builder.set_mp3_settings( crate::json_deser::deser_structure_mp3_settings(tokens)?, ); } "opusSettings" => { builder = builder.set_opus_settings( crate::json_deser::deser_structure_opus_settings(tokens)?, ); } "vorbisSettings" => { builder = builder.set_vorbis_settings( crate::json_deser::deser_structure_vorbis_settings(tokens)?, ); } "wavSettings" => { builder = builder.set_wav_settings( crate::json_deser::deser_structure_wav_settings(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_remix_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::RemixSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::RemixSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "channelMapping" => { builder = builder.set_channel_mapping( crate::json_deser::deser_structure_channel_mapping(tokens)?, ); } "channelsIn" => { builder = builder.set_channels_in( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "channelsOut" => { builder = builder.set_channels_out( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_caption_destination_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::CaptionDestinationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::CaptionDestinationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "burninDestinationSettings" => { builder = builder.set_burnin_destination_settings( crate::json_deser::deser_structure_burnin_destination_settings( tokens, )?, ); } "destinationType" => { builder = builder.set_destination_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CaptionDestinationType::from(u.as_ref()) }) }) .transpose()?, ); } "dvbSubDestinationSettings" => { builder = builder.set_dvb_sub_destination_settings( crate::json_deser::deser_structure_dvb_sub_destination_settings(tokens)? ); } "embeddedDestinationSettings" => { builder = builder.set_embedded_destination_settings( crate::json_deser::deser_structure_embedded_destination_settings(tokens)? ); } "imscDestinationSettings" => { builder = builder.set_imsc_destination_settings( crate::json_deser::deser_structure_imsc_destination_settings( tokens, )?, ); } "sccDestinationSettings" => { builder = builder.set_scc_destination_settings( crate::json_deser::deser_structure_scc_destination_settings( tokens, )?, ); } "srtDestinationSettings" => { builder = builder.set_srt_destination_settings( crate::json_deser::deser_structure_srt_destination_settings( tokens, )?, ); } "teletextDestinationSettings" => { builder = builder.set_teletext_destination_settings( crate::json_deser::deser_structure_teletext_destination_settings(tokens)? ); } "ttmlDestinationSettings" => { builder = builder.set_ttml_destination_settings( crate::json_deser::deser_structure_ttml_destination_settings( tokens, )?, ); } "webvttDestinationSettings" => { builder = builder.set_webvtt_destination_settings( crate::json_deser::deser_structure_webvtt_destination_settings( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of__integer_min32_max8182<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<i32>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = smithy_json::deserialize::token::expect_number_or_null(tokens.next())? .map(|v| v.to_i32()); if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_dvb_nit_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::DvbNitSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::DvbNitSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "networkId" => { builder = builder.set_network_id( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "networkName" => { builder = builder.set_network_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "nitInterval" => { builder = builder.set_nit_interval( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_dvb_sdt_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::DvbSdtSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::DvbSdtSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "outputSdt" => { builder = builder.set_output_sdt( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::OutputSdt::from(u.as_ref())) }) .transpose()?, ); } "sdtInterval" => { builder = builder.set_sdt_interval( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "serviceName" => { builder = builder.set_service_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "serviceProviderName" => { builder = builder.set_service_provider_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_dvb_tdt_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::DvbTdtSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::DvbTdtSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "tdtInterval" => { builder = builder.set_tdt_interval( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_m2ts_scte35_esam<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::M2tsScte35Esam>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::M2tsScte35Esam::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "scte35EsamPid" => { builder = builder.set_scte35_esam_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_mxf_xavc_profile_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::MxfXavcProfileSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::MxfXavcProfileSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "durationMode" => { builder = builder.set_duration_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::MxfXavcDurationMode::from(u.as_ref()) }) }) .transpose()?, ); } "maxAncDataSize" => { builder = builder.set_max_anc_data_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_av1_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Av1Settings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Av1Settings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "adaptiveQuantization" => { builder = builder.set_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Av1AdaptiveQuantization::from(u.as_ref()) }) }) .transpose()?, ); } "framerateControl" => { builder = builder.set_framerate_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Av1FramerateControl::from(u.as_ref()) }) }) .transpose()?, ); } "framerateConversionAlgorithm" => { builder = builder.set_framerate_conversion_algorithm( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Av1FramerateConversionAlgorithm::from( u.as_ref(), ) }) }) .transpose()?, ); } "framerateDenominator" => { builder = builder.set_framerate_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateNumerator" => { builder = builder.set_framerate_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "gopSize" => { builder = builder.set_gop_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "maxBitrate" => { builder = builder.set_max_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "numberBFramesBetweenReferenceFrames" => { builder = builder.set_number_b_frames_between_reference_frames( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "qvbrSettings" => { builder = builder.set_qvbr_settings( crate::json_deser::deser_structure_av1_qvbr_settings(tokens)?, ); } "rateControlMode" => { builder = builder.set_rate_control_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Av1RateControlMode::from(u.as_ref()) }) }) .transpose()?, ); } "slices" => { builder = builder.set_slices( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "spatialAdaptiveQuantization" => { builder = builder.set_spatial_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Av1SpatialAdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_avc_intra_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AvcIntraSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AvcIntraSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "avcIntraClass" => { builder = builder.set_avc_intra_class( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::AvcIntraClass::from(u.as_ref())) }) .transpose()?, ); } "avcIntraUhdSettings" => { builder = builder.set_avc_intra_uhd_settings( crate::json_deser::deser_structure_avc_intra_uhd_settings( tokens, )?, ); } "framerateControl" => { builder = builder.set_framerate_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AvcIntraFramerateControl::from(u.as_ref()) }) }) .transpose()?, ); } "framerateConversionAlgorithm" => { builder = builder.set_framerate_conversion_algorithm( smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| s.to_unescaped().map(|u| crate::model::AvcIntraFramerateConversionAlgorithm::from(u.as_ref()) ) ).transpose()? ); } "framerateDenominator" => { builder = builder.set_framerate_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateNumerator" => { builder = builder.set_framerate_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "interlaceMode" => { builder = builder.set_interlace_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AvcIntraInterlaceMode::from(u.as_ref()) }) }) .transpose()?, ); } "scanTypeConversionMode" => { builder = builder.set_scan_type_conversion_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AvcIntraScanTypeConversionMode::from( u.as_ref(), ) }) }) .transpose()?, ); } "slowPal" => { builder = builder.set_slow_pal( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AvcIntraSlowPal::from(u.as_ref()) }) }) .transpose()?, ); } "telecine" => { builder = builder.set_telecine( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AvcIntraTelecine::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_frame_capture_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::FrameCaptureSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::FrameCaptureSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "framerateDenominator" => { builder = builder.set_framerate_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateNumerator" => { builder = builder.set_framerate_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "maxCaptures" => { builder = builder.set_max_captures( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "quality" => { builder = builder.set_quality( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_h264_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::H264Settings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::H264Settings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "adaptiveQuantization" => { builder = builder.set_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264AdaptiveQuantization::from(u.as_ref()) }) }) .transpose()?, ); } "bitrate" => { builder = builder.set_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "codecLevel" => { builder = builder.set_codec_level( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::H264CodecLevel::from(u.as_ref())) }) .transpose()?, ); } "codecProfile" => { builder = builder.set_codec_profile( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264CodecProfile::from(u.as_ref()) }) }) .transpose()?, ); } "dynamicSubGop" => { builder = builder.set_dynamic_sub_gop( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264DynamicSubGop::from(u.as_ref()) }) }) .transpose()?, ); } "entropyEncoding" => { builder = builder.set_entropy_encoding( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264EntropyEncoding::from(u.as_ref()) }) }) .transpose()?, ); } "fieldEncoding" => { builder = builder.set_field_encoding( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264FieldEncoding::from(u.as_ref()) }) }) .transpose()?, ); } "flickerAdaptiveQuantization" => { builder = builder.set_flicker_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264FlickerAdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } "framerateControl" => { builder = builder.set_framerate_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264FramerateControl::from(u.as_ref()) }) }) .transpose()?, ); } "framerateConversionAlgorithm" => { builder = builder.set_framerate_conversion_algorithm( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264FramerateConversionAlgorithm::from( u.as_ref(), ) }) }) .transpose()?, ); } "framerateDenominator" => { builder = builder.set_framerate_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateNumerator" => { builder = builder.set_framerate_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "gopBReference" => { builder = builder.set_gop_b_reference( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264GopBReference::from(u.as_ref()) }) }) .transpose()?, ); } "gopClosedCadence" => { builder = builder.set_gop_closed_cadence( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "gopSize" => { builder = builder.set_gop_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "gopSizeUnits" => { builder = builder.set_gop_size_units( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264GopSizeUnits::from(u.as_ref()) }) }) .transpose()?, ); } "hrdBufferInitialFillPercentage" => { builder = builder.set_hrd_buffer_initial_fill_percentage( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "hrdBufferSize" => { builder = builder.set_hrd_buffer_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "interlaceMode" => { builder = builder.set_interlace_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264InterlaceMode::from(u.as_ref()) }) }) .transpose()?, ); } "maxBitrate" => { builder = builder.set_max_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "minIInterval" => { builder = builder.set_min_i_interval( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "numberBFramesBetweenReferenceFrames" => { builder = builder.set_number_b_frames_between_reference_frames( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "numberReferenceFrames" => { builder = builder.set_number_reference_frames( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "parControl" => { builder = builder.set_par_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::H264ParControl::from(u.as_ref())) }) .transpose()?, ); } "parDenominator" => { builder = builder.set_par_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "parNumerator" => { builder = builder.set_par_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "qualityTuningLevel" => { builder = builder.set_quality_tuning_level( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264QualityTuningLevel::from(u.as_ref()) }) }) .transpose()?, ); } "qvbrSettings" => { builder = builder.set_qvbr_settings( crate::json_deser::deser_structure_h264_qvbr_settings(tokens)?, ); } "rateControlMode" => { builder = builder.set_rate_control_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264RateControlMode::from(u.as_ref()) }) }) .transpose()?, ); } "repeatPps" => { builder = builder.set_repeat_pps( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::H264RepeatPps::from(u.as_ref())) }) .transpose()?, ); } "scanTypeConversionMode" => { builder = builder.set_scan_type_conversion_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264ScanTypeConversionMode::from( u.as_ref(), ) }) }) .transpose()?, ); } "sceneChangeDetect" => { builder = builder.set_scene_change_detect( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264SceneChangeDetect::from(u.as_ref()) }) }) .transpose()?, ); } "slices" => { builder = builder.set_slices( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "slowPal" => { builder = builder.set_slow_pal( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::H264SlowPal::from(u.as_ref())) }) .transpose()?, ); } "softness" => { builder = builder.set_softness( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "spatialAdaptiveQuantization" => { builder = builder.set_spatial_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264SpatialAdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } "syntax" => { builder = builder.set_syntax( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::H264Syntax::from(u.as_ref())) }) .transpose()?, ); } "telecine" => { builder = builder.set_telecine( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::H264Telecine::from(u.as_ref())) }) .transpose()?, ); } "temporalAdaptiveQuantization" => { builder = builder.set_temporal_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264TemporalAdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } "unregisteredSeiTimecode" => { builder = builder.set_unregistered_sei_timecode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H264UnregisteredSeiTimecode::from( u.as_ref(), ) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_h265_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::H265Settings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::H265Settings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "adaptiveQuantization" => { builder = builder.set_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265AdaptiveQuantization::from(u.as_ref()) }) }) .transpose()?, ); } "alternateTransferFunctionSei" => { builder = builder.set_alternate_transfer_function_sei( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265AlternateTransferFunctionSei::from( u.as_ref(), ) }) }) .transpose()?, ); } "bitrate" => { builder = builder.set_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "codecLevel" => { builder = builder.set_codec_level( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::H265CodecLevel::from(u.as_ref())) }) .transpose()?, ); } "codecProfile" => { builder = builder.set_codec_profile( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265CodecProfile::from(u.as_ref()) }) }) .transpose()?, ); } "dynamicSubGop" => { builder = builder.set_dynamic_sub_gop( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265DynamicSubGop::from(u.as_ref()) }) }) .transpose()?, ); } "flickerAdaptiveQuantization" => { builder = builder.set_flicker_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265FlickerAdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } "framerateControl" => { builder = builder.set_framerate_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265FramerateControl::from(u.as_ref()) }) }) .transpose()?, ); } "framerateConversionAlgorithm" => { builder = builder.set_framerate_conversion_algorithm( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265FramerateConversionAlgorithm::from( u.as_ref(), ) }) }) .transpose()?, ); } "framerateDenominator" => { builder = builder.set_framerate_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateNumerator" => { builder = builder.set_framerate_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "gopBReference" => { builder = builder.set_gop_b_reference( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265GopBReference::from(u.as_ref()) }) }) .transpose()?, ); } "gopClosedCadence" => { builder = builder.set_gop_closed_cadence( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "gopSize" => { builder = builder.set_gop_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "gopSizeUnits" => { builder = builder.set_gop_size_units( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265GopSizeUnits::from(u.as_ref()) }) }) .transpose()?, ); } "hrdBufferInitialFillPercentage" => { builder = builder.set_hrd_buffer_initial_fill_percentage( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "hrdBufferSize" => { builder = builder.set_hrd_buffer_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "interlaceMode" => { builder = builder.set_interlace_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265InterlaceMode::from(u.as_ref()) }) }) .transpose()?, ); } "maxBitrate" => { builder = builder.set_max_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "minIInterval" => { builder = builder.set_min_i_interval( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "numberBFramesBetweenReferenceFrames" => { builder = builder.set_number_b_frames_between_reference_frames( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "numberReferenceFrames" => { builder = builder.set_number_reference_frames( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "parControl" => { builder = builder.set_par_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::H265ParControl::from(u.as_ref())) }) .transpose()?, ); } "parDenominator" => { builder = builder.set_par_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "parNumerator" => { builder = builder.set_par_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "qualityTuningLevel" => { builder = builder.set_quality_tuning_level( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265QualityTuningLevel::from(u.as_ref()) }) }) .transpose()?, ); } "qvbrSettings" => { builder = builder.set_qvbr_settings( crate::json_deser::deser_structure_h265_qvbr_settings(tokens)?, ); } "rateControlMode" => { builder = builder.set_rate_control_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265RateControlMode::from(u.as_ref()) }) }) .transpose()?, ); } "sampleAdaptiveOffsetFilterMode" => { builder = builder.set_sample_adaptive_offset_filter_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265SampleAdaptiveOffsetFilterMode::from( u.as_ref(), ) }) }) .transpose()?, ); } "scanTypeConversionMode" => { builder = builder.set_scan_type_conversion_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265ScanTypeConversionMode::from( u.as_ref(), ) }) }) .transpose()?, ); } "sceneChangeDetect" => { builder = builder.set_scene_change_detect( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265SceneChangeDetect::from(u.as_ref()) }) }) .transpose()?, ); } "slices" => { builder = builder.set_slices( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "slowPal" => { builder = builder.set_slow_pal( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::H265SlowPal::from(u.as_ref())) }) .transpose()?, ); } "spatialAdaptiveQuantization" => { builder = builder.set_spatial_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265SpatialAdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } "telecine" => { builder = builder.set_telecine( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::H265Telecine::from(u.as_ref())) }) .transpose()?, ); } "temporalAdaptiveQuantization" => { builder = builder.set_temporal_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265TemporalAdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } "temporalIds" => { builder = builder.set_temporal_ids( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265TemporalIds::from(u.as_ref()) }) }) .transpose()?, ); } "tiles" => { builder = builder.set_tiles( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::H265Tiles::from(u.as_ref())) }) .transpose()?, ); } "unregisteredSeiTimecode" => { builder = builder.set_unregistered_sei_timecode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265UnregisteredSeiTimecode::from( u.as_ref(), ) }) }) .transpose()?, ); } "writeMp4PackagingType" => { builder = builder.set_write_mp4_packaging_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::H265WriteMp4PackagingType::from( u.as_ref(), ) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_mpeg2_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Mpeg2Settings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Mpeg2Settings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "adaptiveQuantization" => { builder = builder.set_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2AdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } "bitrate" => { builder = builder.set_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "codecLevel" => { builder = builder.set_codec_level( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2CodecLevel::from(u.as_ref()) }) }) .transpose()?, ); } "codecProfile" => { builder = builder.set_codec_profile( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2CodecProfile::from(u.as_ref()) }) }) .transpose()?, ); } "dynamicSubGop" => { builder = builder.set_dynamic_sub_gop( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2DynamicSubGop::from(u.as_ref()) }) }) .transpose()?, ); } "framerateControl" => { builder = builder.set_framerate_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2FramerateControl::from(u.as_ref()) }) }) .transpose()?, ); } "framerateConversionAlgorithm" => { builder = builder.set_framerate_conversion_algorithm( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2FramerateConversionAlgorithm::from( u.as_ref(), ) }) }) .transpose()?, ); } "framerateDenominator" => { builder = builder.set_framerate_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateNumerator" => { builder = builder.set_framerate_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "gopClosedCadence" => { builder = builder.set_gop_closed_cadence( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "gopSize" => { builder = builder.set_gop_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "gopSizeUnits" => { builder = builder.set_gop_size_units( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2GopSizeUnits::from(u.as_ref()) }) }) .transpose()?, ); } "hrdBufferInitialFillPercentage" => { builder = builder.set_hrd_buffer_initial_fill_percentage( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "hrdBufferSize" => { builder = builder.set_hrd_buffer_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "interlaceMode" => { builder = builder.set_interlace_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2InterlaceMode::from(u.as_ref()) }) }) .transpose()?, ); } "intraDcPrecision" => { builder = builder.set_intra_dc_precision( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2IntraDcPrecision::from(u.as_ref()) }) }) .transpose()?, ); } "maxBitrate" => { builder = builder.set_max_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "minIInterval" => { builder = builder.set_min_i_interval( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "numberBFramesBetweenReferenceFrames" => { builder = builder.set_number_b_frames_between_reference_frames( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "parControl" => { builder = builder.set_par_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2ParControl::from(u.as_ref()) }) }) .transpose()?, ); } "parDenominator" => { builder = builder.set_par_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "parNumerator" => { builder = builder.set_par_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "qualityTuningLevel" => { builder = builder.set_quality_tuning_level( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2QualityTuningLevel::from(u.as_ref()) }) }) .transpose()?, ); } "rateControlMode" => { builder = builder.set_rate_control_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2RateControlMode::from(u.as_ref()) }) }) .transpose()?, ); } "scanTypeConversionMode" => { builder = builder.set_scan_type_conversion_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2ScanTypeConversionMode::from( u.as_ref(), ) }) }) .transpose()?, ); } "sceneChangeDetect" => { builder = builder.set_scene_change_detect( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2SceneChangeDetect::from(u.as_ref()) }) }) .transpose()?, ); } "slowPal" => { builder = builder.set_slow_pal( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Mpeg2SlowPal::from(u.as_ref())) }) .transpose()?, ); } "softness" => { builder = builder.set_softness( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "spatialAdaptiveQuantization" => { builder = builder.set_spatial_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2SpatialAdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } "syntax" => { builder = builder.set_syntax( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Mpeg2Syntax::from(u.as_ref())) }) .transpose()?, ); } "telecine" => { builder = builder.set_telecine( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Mpeg2Telecine::from(u.as_ref())) }) .transpose()?, ); } "temporalAdaptiveQuantization" => { builder = builder.set_temporal_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mpeg2TemporalAdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_prores_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ProresSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ProresSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "chromaSampling" => { builder = builder.set_chroma_sampling( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ProresChromaSampling::from(u.as_ref()) }) }) .transpose()?, ); } "codecProfile" => { builder = builder.set_codec_profile( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ProresCodecProfile::from(u.as_ref()) }) }) .transpose()?, ); } "framerateControl" => { builder = builder.set_framerate_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ProresFramerateControl::from(u.as_ref()) }) }) .transpose()?, ); } "framerateConversionAlgorithm" => { builder = builder.set_framerate_conversion_algorithm( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ProresFramerateConversionAlgorithm::from( u.as_ref(), ) }) }) .transpose()?, ); } "framerateDenominator" => { builder = builder.set_framerate_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateNumerator" => { builder = builder.set_framerate_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "interlaceMode" => { builder = builder.set_interlace_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ProresInterlaceMode::from(u.as_ref()) }) }) .transpose()?, ); } "parControl" => { builder = builder.set_par_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ProresParControl::from(u.as_ref()) }) }) .transpose()?, ); } "parDenominator" => { builder = builder.set_par_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "parNumerator" => { builder = builder.set_par_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "scanTypeConversionMode" => { builder = builder.set_scan_type_conversion_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ProresScanTypeConversionMode::from( u.as_ref(), ) }) }) .transpose()?, ); } "slowPal" => { builder = builder.set_slow_pal( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::ProresSlowPal::from(u.as_ref())) }) .transpose()?, ); } "telecine" => { builder = builder.set_telecine( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::ProresTelecine::from(u.as_ref())) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_vc3_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Vc3Settings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Vc3Settings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "framerateControl" => { builder = builder.set_framerate_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Vc3FramerateControl::from(u.as_ref()) }) }) .transpose()?, ); } "framerateConversionAlgorithm" => { builder = builder.set_framerate_conversion_algorithm( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Vc3FramerateConversionAlgorithm::from( u.as_ref(), ) }) }) .transpose()?, ); } "framerateDenominator" => { builder = builder.set_framerate_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateNumerator" => { builder = builder.set_framerate_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "interlaceMode" => { builder = builder.set_interlace_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Vc3InterlaceMode::from(u.as_ref()) }) }) .transpose()?, ); } "scanTypeConversionMode" => { builder = builder.set_scan_type_conversion_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Vc3ScanTypeConversionMode::from( u.as_ref(), ) }) }) .transpose()?, ); } "slowPal" => { builder = builder.set_slow_pal( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Vc3SlowPal::from(u.as_ref())) }) .transpose()?, ); } "telecine" => { builder = builder.set_telecine( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Vc3Telecine::from(u.as_ref())) }) .transpose()?, ); } "vc3Class" => { builder = builder.set_vc3_class( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Vc3Class::from(u.as_ref())) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_vp8_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Vp8Settings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Vp8Settings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "bitrate" => { builder = builder.set_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateControl" => { builder = builder.set_framerate_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Vp8FramerateControl::from(u.as_ref()) }) }) .transpose()?, ); } "framerateConversionAlgorithm" => { builder = builder.set_framerate_conversion_algorithm( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Vp8FramerateConversionAlgorithm::from( u.as_ref(), ) }) }) .transpose()?, ); } "framerateDenominator" => { builder = builder.set_framerate_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateNumerator" => { builder = builder.set_framerate_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "gopSize" => { builder = builder.set_gop_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "hrdBufferSize" => { builder = builder.set_hrd_buffer_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "maxBitrate" => { builder = builder.set_max_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "parControl" => { builder = builder.set_par_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Vp8ParControl::from(u.as_ref())) }) .transpose()?, ); } "parDenominator" => { builder = builder.set_par_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "parNumerator" => { builder = builder.set_par_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "qualityTuningLevel" => { builder = builder.set_quality_tuning_level( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Vp8QualityTuningLevel::from(u.as_ref()) }) }) .transpose()?, ); } "rateControlMode" => { builder = builder.set_rate_control_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Vp8RateControlMode::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_vp9_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Vp9Settings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Vp9Settings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "bitrate" => { builder = builder.set_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateControl" => { builder = builder.set_framerate_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Vp9FramerateControl::from(u.as_ref()) }) }) .transpose()?, ); } "framerateConversionAlgorithm" => { builder = builder.set_framerate_conversion_algorithm( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Vp9FramerateConversionAlgorithm::from( u.as_ref(), ) }) }) .transpose()?, ); } "framerateDenominator" => { builder = builder.set_framerate_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateNumerator" => { builder = builder.set_framerate_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "gopSize" => { builder = builder.set_gop_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "hrdBufferSize" => { builder = builder.set_hrd_buffer_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "maxBitrate" => { builder = builder.set_max_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "parControl" => { builder = builder.set_par_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Vp9ParControl::from(u.as_ref())) }) .transpose()?, ); } "parDenominator" => { builder = builder.set_par_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "parNumerator" => { builder = builder.set_par_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "qualityTuningLevel" => { builder = builder.set_quality_tuning_level( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Vp9QualityTuningLevel::from(u.as_ref()) }) }) .transpose()?, ); } "rateControlMode" => { builder = builder.set_rate_control_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Vp9RateControlMode::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_xavc_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::XavcSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::XavcSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "adaptiveQuantization" => { builder = builder.set_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcAdaptiveQuantization::from(u.as_ref()) }) }) .transpose()?, ); } "entropyEncoding" => { builder = builder.set_entropy_encoding( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcEntropyEncoding::from(u.as_ref()) }) }) .transpose()?, ); } "framerateControl" => { builder = builder.set_framerate_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcFramerateControl::from(u.as_ref()) }) }) .transpose()?, ); } "framerateConversionAlgorithm" => { builder = builder.set_framerate_conversion_algorithm( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcFramerateConversionAlgorithm::from( u.as_ref(), ) }) }) .transpose()?, ); } "framerateDenominator" => { builder = builder.set_framerate_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateNumerator" => { builder = builder.set_framerate_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "profile" => { builder = builder.set_profile( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::XavcProfile::from(u.as_ref())) }) .transpose()?, ); } "slowPal" => { builder = builder.set_slow_pal( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::XavcSlowPal::from(u.as_ref())) }) .transpose()?, ); } "softness" => { builder = builder.set_softness( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "spatialAdaptiveQuantization" => { builder = builder.set_spatial_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcSpatialAdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } "temporalAdaptiveQuantization" => { builder = builder.set_temporal_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcTemporalAdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } "xavc4kIntraCbgProfileSettings" => { builder = builder.set_xavc4k_intra_cbg_profile_settings( crate::json_deser::deser_structure_xavc4k_intra_cbg_profile_settings(tokens)? ); } "xavc4kIntraVbrProfileSettings" => { builder = builder.set_xavc4k_intra_vbr_profile_settings( crate::json_deser::deser_structure_xavc4k_intra_vbr_profile_settings(tokens)? ); } "xavc4kProfileSettings" => { builder = builder.set_xavc4k_profile_settings( crate::json_deser::deser_structure_xavc4k_profile_settings( tokens, )?, ); } "xavcHdIntraCbgProfileSettings" => { builder = builder.set_xavc_hd_intra_cbg_profile_settings( crate::json_deser::deser_structure_xavc_hd_intra_cbg_profile_settings(tokens)? ); } "xavcHdProfileSettings" => { builder = builder.set_xavc_hd_profile_settings( crate::json_deser::deser_structure_xavc_hd_profile_settings( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_color_corrector<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ColorCorrector>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ColorCorrector::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "brightness" => { builder = builder.set_brightness( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "colorSpaceConversion" => { builder = builder.set_color_space_conversion( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ColorSpaceConversion::from(u.as_ref()) }) }) .transpose()?, ); } "contrast" => { builder = builder.set_contrast( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "hdr10Metadata" => { builder = builder.set_hdr10_metadata( crate::json_deser::deser_structure_hdr10_metadata(tokens)?, ); } "hue" => { builder = builder.set_hue( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "sampleRangeConversion" => { builder = builder.set_sample_range_conversion( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::SampleRangeConversion::from(u.as_ref()) }) }) .transpose()?, ); } "saturation" => { builder = builder.set_saturation( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_deinterlacer<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Deinterlacer>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Deinterlacer::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "algorithm" => { builder = builder.set_algorithm( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DeinterlaceAlgorithm::from(u.as_ref()) }) }) .transpose()?, ); } "control" => { builder = builder.set_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DeinterlacerControl::from(u.as_ref()) }) }) .transpose()?, ); } "mode" => { builder = builder.set_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DeinterlacerMode::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_dolby_vision<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::DolbyVision>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::DolbyVision::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "l6Metadata" => { builder = builder.set_l6_metadata( crate::json_deser::deser_structure_dolby_vision_level6_metadata(tokens)? ); } "l6Mode" => { builder = builder.set_l6_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DolbyVisionLevel6Mode::from(u.as_ref()) }) }) .transpose()?, ); } "profile" => { builder = builder.set_profile( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DolbyVisionProfile::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_hdr10_plus<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Hdr10Plus>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Hdr10Plus::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "masteringMonitorNits" => { builder = builder.set_mastering_monitor_nits( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "targetMonitorNits" => { builder = builder.set_target_monitor_nits( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_noise_reducer<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::NoiseReducer>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::NoiseReducer::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "filter" => { builder = builder.set_filter( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::NoiseReducerFilter::from(u.as_ref()) }) }) .transpose()?, ); } "filterSettings" => { builder = builder.set_filter_settings( crate::json_deser::deser_structure_noise_reducer_filter_settings(tokens)? ); } "spatialFilterSettings" => { builder = builder.set_spatial_filter_settings( crate::json_deser::deser_structure_noise_reducer_spatial_filter_settings(tokens)? ); } "temporalFilterSettings" => { builder = builder.set_temporal_filter_settings( crate::json_deser::deser_structure_noise_reducer_temporal_filter_settings(tokens)? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_partner_watermarking<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::PartnerWatermarking>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::PartnerWatermarking::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "nexguardFileMarkerSettings" => { builder = builder.set_nexguard_file_marker_settings( crate::json_deser::deser_structure_nex_guard_file_marker_settings(tokens)? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_timecode_burnin<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TimecodeBurnin>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TimecodeBurnin::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "fontSize" => { builder = builder.set_font_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "position" => { builder = builder.set_position( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::TimecodeBurninPosition::from(u.as_ref()) }) }) .transpose()?, ); } "prefix" => { builder = builder.set_prefix( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_video_detail<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::VideoDetail>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::VideoDetail::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "heightInPx" => { builder = builder.set_height_in_px( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "widthInPx" => { builder = builder.set_width_in_px( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_audio_selector_group<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AudioSelectorGroup>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AudioSelectorGroup::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "audioSelectorNames" => { builder = builder.set_audio_selector_names( crate::json_deser::deser_list___list_of__string_min1(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_audio_selector<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AudioSelector>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AudioSelector::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "customLanguageCode" => { builder = builder.set_custom_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "defaultSelection" => { builder = builder.set_default_selection( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AudioDefaultSelection::from(u.as_ref()) }) }) .transpose()?, ); } "externalAudioFileInput" => { builder = builder.set_external_audio_file_input( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "hlsRenditionGroupSettings" => { builder = builder.set_hls_rendition_group_settings( crate::json_deser::deser_structure_hls_rendition_group_settings(tokens)? ); } "languageCode" => { builder = builder.set_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::LanguageCode::from(u.as_ref())) }) .transpose()?, ); } "offset" => { builder = builder.set_offset( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "pids" => { builder = builder.set_pids( crate::json_deser::deser_list___list_of__integer_min1_max2147483647(tokens)? ); } "programSelection" => { builder = builder.set_program_selection( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "remixSettings" => { builder = builder.set_remix_settings( crate::json_deser::deser_structure_remix_settings(tokens)?, ); } "selectorType" => { builder = builder.set_selector_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AudioSelectorType::from(u.as_ref()) }) }) .transpose()?, ); } "tracks" => { builder = builder.set_tracks( crate::json_deser::deser_list___list_of__integer_min1_max2147483647(tokens)? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_caption_selector<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::CaptionSelector>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::CaptionSelector::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "customLanguageCode" => { builder = builder.set_custom_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "languageCode" => { builder = builder.set_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::LanguageCode::from(u.as_ref())) }) .transpose()?, ); } "sourceSettings" => { builder = builder.set_source_settings( crate::json_deser::deser_structure_caption_source_settings( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_insertable_image<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::InsertableImage>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_insertable_image(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_input_clipping<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::InputClipping>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::InputClipping::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "endTimecode" => { builder = builder.set_end_timecode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "startTimecode" => { builder = builder.set_start_timecode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_hdr10_metadata<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Hdr10Metadata>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Hdr10Metadata::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "bluePrimaryX" => { builder = builder.set_blue_primary_x( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "bluePrimaryY" => { builder = builder.set_blue_primary_y( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "greenPrimaryX" => { builder = builder.set_green_primary_x( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "greenPrimaryY" => { builder = builder.set_green_primary_y( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "maxContentLightLevel" => { builder = builder.set_max_content_light_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "maxFrameAverageLightLevel" => { builder = builder.set_max_frame_average_light_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "maxLuminance" => { builder = builder.set_max_luminance( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "minLuminance" => { builder = builder.set_min_luminance( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "redPrimaryX" => { builder = builder.set_red_primary_x( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "redPrimaryY" => { builder = builder.set_red_primary_y( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "whitePointX" => { builder = builder.set_white_point_x( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "whitePointY" => { builder = builder.set_white_point_y( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_automated_abr_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AutomatedAbrSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AutomatedAbrSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "maxAbrBitrate" => { builder = builder.set_max_abr_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "maxRenditions" => { builder = builder.set_max_renditions( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "minAbrBitrate" => { builder = builder.set_min_abr_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_cmaf_group_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::CmafGroupSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::CmafGroupSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "additionalManifests" => { builder = builder.set_additional_manifests( crate::json_deser::deser_list___list_of_cmaf_additional_manifest(tokens)? ); } "baseUrl" => { builder = builder.set_base_url( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "clientCache" => { builder = builder.set_client_cache( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafClientCache::from(u.as_ref()) }) }) .transpose()?, ); } "codecSpecification" => { builder = builder.set_codec_specification( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafCodecSpecification::from(u.as_ref()) }) }) .transpose()?, ); } "destination" => { builder = builder.set_destination( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "destinationSettings" => { builder = builder.set_destination_settings( crate::json_deser::deser_structure_destination_settings( tokens, )?, ); } "encryption" => { builder = builder.set_encryption( crate::json_deser::deser_structure_cmaf_encryption_settings( tokens, )?, ); } "fragmentLength" => { builder = builder.set_fragment_length( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "imageBasedTrickPlay" => { builder = builder.set_image_based_trick_play( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafImageBasedTrickPlay::from(u.as_ref()) }) }) .transpose()?, ); } "manifestCompression" => { builder = builder.set_manifest_compression( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafManifestCompression::from(u.as_ref()) }) }) .transpose()?, ); } "manifestDurationFormat" => { builder = builder.set_manifest_duration_format( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafManifestDurationFormat::from( u.as_ref(), ) }) }) .transpose()?, ); } "minBufferTime" => { builder = builder.set_min_buffer_time( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "minFinalSegmentLength" => { builder = builder.set_min_final_segment_length( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "mpdProfile" => { builder = builder.set_mpd_profile( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::CmafMpdProfile::from(u.as_ref())) }) .transpose()?, ); } "ptsOffsetHandlingForBFrames" => { builder = builder.set_pts_offset_handling_for_b_frames( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafPtsOffsetHandlingForBFrames::from( u.as_ref(), ) }) }) .transpose()?, ); } "segmentControl" => { builder = builder.set_segment_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafSegmentControl::from(u.as_ref()) }) }) .transpose()?, ); } "segmentLength" => { builder = builder.set_segment_length( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "segmentLengthControl" => { builder = builder.set_segment_length_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafSegmentLengthControl::from(u.as_ref()) }) }) .transpose()?, ); } "streamInfResolution" => { builder = builder.set_stream_inf_resolution( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafStreamInfResolution::from(u.as_ref()) }) }) .transpose()?, ); } "targetDurationCompatibilityMode" => { builder = builder.set_target_duration_compatibility_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafTargetDurationCompatibilityMode::from( u.as_ref(), ) }) }) .transpose()?, ); } "writeDashManifest" => { builder = builder.set_write_dash_manifest( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafWriteDashManifest::from(u.as_ref()) }) }) .transpose()?, ); } "writeHlsManifest" => { builder = builder.set_write_hls_manifest( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafWriteHlsManifest::from(u.as_ref()) }) }) .transpose()?, ); } "writeSegmentTimelineInRepresentation" => { builder = builder.set_write_segment_timeline_in_representation( smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| s.to_unescaped().map(|u| crate::model::CmafWriteSegmentTimelineInRepresentation::from(u.as_ref()) ) ).transpose()? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_dash_iso_group_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::DashIsoGroupSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::DashIsoGroupSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "additionalManifests" => { builder = builder.set_additional_manifests( crate::json_deser::deser_list___list_of_dash_additional_manifest(tokens)? ); } "audioChannelConfigSchemeIdUri" => { builder = builder.set_audio_channel_config_scheme_id_uri( smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| s.to_unescaped().map(|u| crate::model::DashIsoGroupAudioChannelConfigSchemeIdUri::from(u.as_ref()) ) ).transpose()? ); } "baseUrl" => { builder = builder.set_base_url( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "destination" => { builder = builder.set_destination( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "destinationSettings" => { builder = builder.set_destination_settings( crate::json_deser::deser_structure_destination_settings( tokens, )?, ); } "encryption" => { builder = builder.set_encryption( crate::json_deser::deser_structure_dash_iso_encryption_settings(tokens)? ); } "fragmentLength" => { builder = builder.set_fragment_length( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "hbbtvCompliance" => { builder = builder.set_hbbtv_compliance( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DashIsoHbbtvCompliance::from(u.as_ref()) }) }) .transpose()?, ); } "imageBasedTrickPlay" => { builder = builder.set_image_based_trick_play( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DashIsoImageBasedTrickPlay::from( u.as_ref(), ) }) }) .transpose()?, ); } "minBufferTime" => { builder = builder.set_min_buffer_time( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "minFinalSegmentLength" => { builder = builder.set_min_final_segment_length( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "mpdProfile" => { builder = builder.set_mpd_profile( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DashIsoMpdProfile::from(u.as_ref()) }) }) .transpose()?, ); } "ptsOffsetHandlingForBFrames" => { builder = builder.set_pts_offset_handling_for_b_frames( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DashIsoPtsOffsetHandlingForBFrames::from( u.as_ref(), ) }) }) .transpose()?, ); } "segmentControl" => { builder = builder.set_segment_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DashIsoSegmentControl::from(u.as_ref()) }) }) .transpose()?, ); } "segmentLength" => { builder = builder.set_segment_length( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "segmentLengthControl" => { builder = builder.set_segment_length_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DashIsoSegmentLengthControl::from( u.as_ref(), ) }) }) .transpose()?, ); } "writeSegmentTimelineInRepresentation" => { builder = builder.set_write_segment_timeline_in_representation( smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| s.to_unescaped().map(|u| crate::model::DashIsoWriteSegmentTimelineInRepresentation::from(u.as_ref()) ) ).transpose()? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_file_group_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::FileGroupSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::FileGroupSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "destination" => { builder = builder.set_destination( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "destinationSettings" => { builder = builder.set_destination_settings( crate::json_deser::deser_structure_destination_settings( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_hls_group_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::HlsGroupSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::HlsGroupSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "adMarkers" => { builder = builder.set_ad_markers( crate::json_deser::deser_list___list_of_hls_ad_markers(tokens)?, ); } "additionalManifests" => { builder = builder.set_additional_manifests( crate::json_deser::deser_list___list_of_hls_additional_manifest(tokens)? ); } "audioOnlyHeader" => { builder = builder.set_audio_only_header( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsAudioOnlyHeader::from(u.as_ref()) }) }) .transpose()?, ); } "baseUrl" => { builder = builder.set_base_url( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "captionLanguageMappings" => { builder = builder.set_caption_language_mappings( crate::json_deser::deser_list___list_of_hls_caption_language_mapping(tokens)? ); } "captionLanguageSetting" => { builder = builder.set_caption_language_setting( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsCaptionLanguageSetting::from( u.as_ref(), ) }) }) .transpose()?, ); } "clientCache" => { builder = builder.set_client_cache( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::HlsClientCache::from(u.as_ref())) }) .transpose()?, ); } "codecSpecification" => { builder = builder.set_codec_specification( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsCodecSpecification::from(u.as_ref()) }) }) .transpose()?, ); } "destination" => { builder = builder.set_destination( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "destinationSettings" => { builder = builder.set_destination_settings( crate::json_deser::deser_structure_destination_settings( tokens, )?, ); } "directoryStructure" => { builder = builder.set_directory_structure( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsDirectoryStructure::from(u.as_ref()) }) }) .transpose()?, ); } "encryption" => { builder = builder.set_encryption( crate::json_deser::deser_structure_hls_encryption_settings( tokens, )?, ); } "imageBasedTrickPlay" => { builder = builder.set_image_based_trick_play( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsImageBasedTrickPlay::from(u.as_ref()) }) }) .transpose()?, ); } "manifestCompression" => { builder = builder.set_manifest_compression( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsManifestCompression::from(u.as_ref()) }) }) .transpose()?, ); } "manifestDurationFormat" => { builder = builder.set_manifest_duration_format( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsManifestDurationFormat::from( u.as_ref(), ) }) }) .transpose()?, ); } "minFinalSegmentLength" => { builder = builder.set_min_final_segment_length( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "minSegmentLength" => { builder = builder.set_min_segment_length( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "outputSelection" => { builder = builder.set_output_selection( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsOutputSelection::from(u.as_ref()) }) }) .transpose()?, ); } "programDateTime" => { builder = builder.set_program_date_time( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsProgramDateTime::from(u.as_ref()) }) }) .transpose()?, ); } "programDateTimePeriod" => { builder = builder.set_program_date_time_period( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "segmentControl" => { builder = builder.set_segment_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsSegmentControl::from(u.as_ref()) }) }) .transpose()?, ); } "segmentLength" => { builder = builder.set_segment_length( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "segmentLengthControl" => { builder = builder.set_segment_length_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsSegmentLengthControl::from(u.as_ref()) }) }) .transpose()?, ); } "segmentsPerSubdirectory" => { builder = builder.set_segments_per_subdirectory( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "streamInfResolution" => { builder = builder.set_stream_inf_resolution( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsStreamInfResolution::from(u.as_ref()) }) }) .transpose()?, ); } "targetDurationCompatibilityMode" => { builder = builder.set_target_duration_compatibility_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsTargetDurationCompatibilityMode::from( u.as_ref(), ) }) }) .transpose()?, ); } "timedMetadataId3Frame" => { builder = builder.set_timed_metadata_id3_frame( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsTimedMetadataId3Frame::from(u.as_ref()) }) }) .transpose()?, ); } "timedMetadataId3Period" => { builder = builder.set_timed_metadata_id3_period( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "timestampDeltaMilliseconds" => { builder = builder.set_timestamp_delta_milliseconds( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_ms_smooth_group_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::MsSmoothGroupSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::MsSmoothGroupSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "additionalManifests" => { builder = builder.set_additional_manifests( crate::json_deser::deser_list___list_of_ms_smooth_additional_manifest(tokens)? ); } "audioDeduplication" => { builder = builder.set_audio_deduplication( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::MsSmoothAudioDeduplication::from( u.as_ref(), ) }) }) .transpose()?, ); } "destination" => { builder = builder.set_destination( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "destinationSettings" => { builder = builder.set_destination_settings( crate::json_deser::deser_structure_destination_settings( tokens, )?, ); } "encryption" => { builder = builder.set_encryption( crate::json_deser::deser_structure_ms_smooth_encryption_settings(tokens)? ); } "fragmentLength" => { builder = builder.set_fragment_length( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "fragmentLengthControl" => { builder = builder.set_fragment_length_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::MsSmoothFragmentLengthControl::from( u.as_ref(), ) }) }) .transpose()?, ); } "manifestEncoding" => { builder = builder.set_manifest_encoding( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::MsSmoothManifestEncoding::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_output<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Output>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Output::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "audioDescriptions" => { builder = builder.set_audio_descriptions( crate::json_deser::deser_list___list_of_audio_description( tokens, )?, ); } "captionDescriptions" => { builder = builder.set_caption_descriptions( crate::json_deser::deser_list___list_of_caption_description( tokens, )?, ); } "containerSettings" => { builder = builder.set_container_settings( crate::json_deser::deser_structure_container_settings(tokens)?, ); } "extension" => { builder = builder.set_extension( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "nameModifier" => { builder = builder.set_name_modifier( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "outputSettings" => { builder = builder.set_output_settings( crate::json_deser::deser_structure_output_settings(tokens)?, ); } "preset" => { builder = builder.set_preset( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "videoDescription" => { builder = builder.set_video_description( crate::json_deser::deser_structure_video_description(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_aac_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AacSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AacSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "audioDescriptionBroadcasterMix" => { builder = builder.set_audio_description_broadcaster_mix( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AacAudioDescriptionBroadcasterMix::from( u.as_ref(), ) }) }) .transpose()?, ); } "bitrate" => { builder = builder.set_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "codecProfile" => { builder = builder.set_codec_profile( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AacCodecProfile::from(u.as_ref()) }) }) .transpose()?, ); } "codingMode" => { builder = builder.set_coding_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::AacCodingMode::from(u.as_ref())) }) .transpose()?, ); } "rateControlMode" => { builder = builder.set_rate_control_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AacRateControlMode::from(u.as_ref()) }) }) .transpose()?, ); } "rawFormat" => { builder = builder.set_raw_format( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::AacRawFormat::from(u.as_ref())) }) .transpose()?, ); } "sampleRate" => { builder = builder.set_sample_rate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "specification" => { builder = builder.set_specification( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AacSpecification::from(u.as_ref()) }) }) .transpose()?, ); } "vbrQuality" => { builder = builder.set_vbr_quality( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::AacVbrQuality::from(u.as_ref())) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_ac3_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Ac3Settings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Ac3Settings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "bitrate" => { builder = builder.set_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "bitstreamMode" => { builder = builder.set_bitstream_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Ac3BitstreamMode::from(u.as_ref()) }) }) .transpose()?, ); } "codingMode" => { builder = builder.set_coding_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Ac3CodingMode::from(u.as_ref())) }) .transpose()?, ); } "dialnorm" => { builder = builder.set_dialnorm( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "dynamicRangeCompressionLine" => { builder = builder.set_dynamic_range_compression_line( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Ac3DynamicRangeCompressionLine::from( u.as_ref(), ) }) }) .transpose()?, ); } "dynamicRangeCompressionProfile" => { builder = builder.set_dynamic_range_compression_profile( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Ac3DynamicRangeCompressionProfile::from( u.as_ref(), ) }) }) .transpose()?, ); } "dynamicRangeCompressionRf" => { builder = builder.set_dynamic_range_compression_rf( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Ac3DynamicRangeCompressionRf::from( u.as_ref(), ) }) }) .transpose()?, ); } "lfeFilter" => { builder = builder.set_lfe_filter( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Ac3LfeFilter::from(u.as_ref())) }) .transpose()?, ); } "metadataControl" => { builder = builder.set_metadata_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Ac3MetadataControl::from(u.as_ref()) }) }) .transpose()?, ); } "sampleRate" => { builder = builder.set_sample_rate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_aiff_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AiffSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AiffSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "bitDepth" => { builder = builder.set_bit_depth( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "channels" => { builder = builder.set_channels( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "sampleRate" => { builder = builder.set_sample_rate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_eac3_atmos_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Eac3AtmosSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Eac3AtmosSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "bitrate" => { builder = builder.set_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "bitstreamMode" => { builder = builder.set_bitstream_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3AtmosBitstreamMode::from(u.as_ref()) }) }) .transpose()?, ); } "codingMode" => { builder = builder.set_coding_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3AtmosCodingMode::from(u.as_ref()) }) }) .transpose()?, ); } "dialogueIntelligence" => { builder = builder.set_dialogue_intelligence( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3AtmosDialogueIntelligence::from( u.as_ref(), ) }) }) .transpose()?, ); } "downmixControl" => { builder = builder.set_downmix_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3AtmosDownmixControl::from(u.as_ref()) }) }) .transpose()?, ); } "dynamicRangeCompressionLine" => { builder = builder.set_dynamic_range_compression_line( smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| s.to_unescaped().map(|u| crate::model::Eac3AtmosDynamicRangeCompressionLine::from(u.as_ref()) ) ).transpose()? ); } "dynamicRangeCompressionRf" => { builder = builder.set_dynamic_range_compression_rf( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3AtmosDynamicRangeCompressionRf::from( u.as_ref(), ) }) }) .transpose()?, ); } "dynamicRangeControl" => { builder = builder.set_dynamic_range_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3AtmosDynamicRangeControl::from( u.as_ref(), ) }) }) .transpose()?, ); } "loRoCenterMixLevel" => { builder = builder.set_lo_ro_center_mix_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "loRoSurroundMixLevel" => { builder = builder.set_lo_ro_surround_mix_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "ltRtCenterMixLevel" => { builder = builder.set_lt_rt_center_mix_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "ltRtSurroundMixLevel" => { builder = builder.set_lt_rt_surround_mix_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "meteringMode" => { builder = builder.set_metering_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3AtmosMeteringMode::from(u.as_ref()) }) }) .transpose()?, ); } "sampleRate" => { builder = builder.set_sample_rate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "speechThreshold" => { builder = builder.set_speech_threshold( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "stereoDownmix" => { builder = builder.set_stereo_downmix( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3AtmosStereoDownmix::from(u.as_ref()) }) }) .transpose()?, ); } "surroundExMode" => { builder = builder.set_surround_ex_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3AtmosSurroundExMode::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_eac3_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Eac3Settings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Eac3Settings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "attenuationControl" => { builder = builder.set_attenuation_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3AttenuationControl::from(u.as_ref()) }) }) .transpose()?, ); } "bitrate" => { builder = builder.set_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "bitstreamMode" => { builder = builder.set_bitstream_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3BitstreamMode::from(u.as_ref()) }) }) .transpose()?, ); } "codingMode" => { builder = builder.set_coding_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Eac3CodingMode::from(u.as_ref())) }) .transpose()?, ); } "dcFilter" => { builder = builder.set_dc_filter( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Eac3DcFilter::from(u.as_ref())) }) .transpose()?, ); } "dialnorm" => { builder = builder.set_dialnorm( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "dynamicRangeCompressionLine" => { builder = builder.set_dynamic_range_compression_line( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3DynamicRangeCompressionLine::from( u.as_ref(), ) }) }) .transpose()?, ); } "dynamicRangeCompressionRf" => { builder = builder.set_dynamic_range_compression_rf( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3DynamicRangeCompressionRf::from( u.as_ref(), ) }) }) .transpose()?, ); } "lfeControl" => { builder = builder.set_lfe_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Eac3LfeControl::from(u.as_ref())) }) .transpose()?, ); } "lfeFilter" => { builder = builder.set_lfe_filter( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Eac3LfeFilter::from(u.as_ref())) }) .transpose()?, ); } "loRoCenterMixLevel" => { builder = builder.set_lo_ro_center_mix_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "loRoSurroundMixLevel" => { builder = builder.set_lo_ro_surround_mix_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "ltRtCenterMixLevel" => { builder = builder.set_lt_rt_center_mix_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "ltRtSurroundMixLevel" => { builder = builder.set_lt_rt_surround_mix_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "metadataControl" => { builder = builder.set_metadata_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3MetadataControl::from(u.as_ref()) }) }) .transpose()?, ); } "passthroughControl" => { builder = builder.set_passthrough_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3PassthroughControl::from(u.as_ref()) }) }) .transpose()?, ); } "phaseControl" => { builder = builder.set_phase_control( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3PhaseControl::from(u.as_ref()) }) }) .transpose()?, ); } "sampleRate" => { builder = builder.set_sample_rate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "stereoDownmix" => { builder = builder.set_stereo_downmix( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3StereoDownmix::from(u.as_ref()) }) }) .transpose()?, ); } "surroundExMode" => { builder = builder.set_surround_ex_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3SurroundExMode::from(u.as_ref()) }) }) .transpose()?, ); } "surroundMode" => { builder = builder.set_surround_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Eac3SurroundMode::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_mp2_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Mp2Settings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Mp2Settings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "bitrate" => { builder = builder.set_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "channels" => { builder = builder.set_channels( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "sampleRate" => { builder = builder.set_sample_rate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_mp3_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Mp3Settings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Mp3Settings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "bitrate" => { builder = builder.set_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "channels" => { builder = builder.set_channels( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "rateControlMode" => { builder = builder.set_rate_control_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Mp3RateControlMode::from(u.as_ref()) }) }) .transpose()?, ); } "sampleRate" => { builder = builder.set_sample_rate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "vbrQuality" => { builder = builder.set_vbr_quality( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_opus_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::OpusSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::OpusSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "bitrate" => { builder = builder.set_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "channels" => { builder = builder.set_channels( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "sampleRate" => { builder = builder.set_sample_rate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_vorbis_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::VorbisSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::VorbisSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "channels" => { builder = builder.set_channels( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "sampleRate" => { builder = builder.set_sample_rate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "vbrQuality" => { builder = builder.set_vbr_quality( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_wav_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::WavSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::WavSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "bitDepth" => { builder = builder.set_bit_depth( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "channels" => { builder = builder.set_channels( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "format" => { builder = builder.set_format( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::WavFormat::from(u.as_ref())) }) .transpose()?, ); } "sampleRate" => { builder = builder.set_sample_rate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_channel_mapping<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ChannelMapping>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ChannelMapping::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "outputChannels" => { builder = builder.set_output_channels( crate::json_deser::deser_list___list_of_output_channel_mapping( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_burnin_destination_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::BurninDestinationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::BurninDestinationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "alignment" => { builder = builder.set_alignment( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::BurninSubtitleAlignment::from(u.as_ref()) }) }) .transpose()?, ); } "backgroundColor" => { builder = builder.set_background_color( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::BurninSubtitleBackgroundColor::from( u.as_ref(), ) }) }) .transpose()?, ); } "backgroundOpacity" => { builder = builder.set_background_opacity( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "fontColor" => { builder = builder.set_font_color( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::BurninSubtitleFontColor::from(u.as_ref()) }) }) .transpose()?, ); } "fontOpacity" => { builder = builder.set_font_opacity( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "fontResolution" => { builder = builder.set_font_resolution( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "fontScript" => { builder = builder.set_font_script( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::FontScript::from(u.as_ref())) }) .transpose()?, ); } "fontSize" => { builder = builder.set_font_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "outlineColor" => { builder = builder.set_outline_color( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::BurninSubtitleOutlineColor::from( u.as_ref(), ) }) }) .transpose()?, ); } "outlineSize" => { builder = builder.set_outline_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "shadowColor" => { builder = builder.set_shadow_color( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::BurninSubtitleShadowColor::from( u.as_ref(), ) }) }) .transpose()?, ); } "shadowOpacity" => { builder = builder.set_shadow_opacity( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "shadowXOffset" => { builder = builder.set_shadow_x_offset( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "shadowYOffset" => { builder = builder.set_shadow_y_offset( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "teletextSpacing" => { builder = builder.set_teletext_spacing( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::BurninSubtitleTeletextSpacing::from( u.as_ref(), ) }) }) .transpose()?, ); } "xPosition" => { builder = builder.set_x_position( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "yPosition" => { builder = builder.set_y_position( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_dvb_sub_destination_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::DvbSubDestinationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::DvbSubDestinationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "alignment" => { builder = builder.set_alignment( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DvbSubtitleAlignment::from(u.as_ref()) }) }) .transpose()?, ); } "backgroundColor" => { builder = builder.set_background_color( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DvbSubtitleBackgroundColor::from( u.as_ref(), ) }) }) .transpose()?, ); } "backgroundOpacity" => { builder = builder.set_background_opacity( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "ddsHandling" => { builder = builder.set_dds_handling( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::DvbddsHandling::from(u.as_ref())) }) .transpose()?, ); } "ddsXCoordinate" => { builder = builder.set_dds_x_coordinate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "ddsYCoordinate" => { builder = builder.set_dds_y_coordinate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "fontColor" => { builder = builder.set_font_color( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DvbSubtitleFontColor::from(u.as_ref()) }) }) .transpose()?, ); } "fontOpacity" => { builder = builder.set_font_opacity( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "fontResolution" => { builder = builder.set_font_resolution( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "fontScript" => { builder = builder.set_font_script( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::FontScript::from(u.as_ref())) }) .transpose()?, ); } "fontSize" => { builder = builder.set_font_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "height" => { builder = builder.set_height( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "outlineColor" => { builder = builder.set_outline_color( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DvbSubtitleOutlineColor::from(u.as_ref()) }) }) .transpose()?, ); } "outlineSize" => { builder = builder.set_outline_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "shadowColor" => { builder = builder.set_shadow_color( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DvbSubtitleShadowColor::from(u.as_ref()) }) }) .transpose()?, ); } "shadowOpacity" => { builder = builder.set_shadow_opacity( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "shadowXOffset" => { builder = builder.set_shadow_x_offset( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "shadowYOffset" => { builder = builder.set_shadow_y_offset( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "subtitlingType" => { builder = builder.set_subtitling_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DvbSubtitlingType::from(u.as_ref()) }) }) .transpose()?, ); } "teletextSpacing" => { builder = builder.set_teletext_spacing( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DvbSubtitleTeletextSpacing::from( u.as_ref(), ) }) }) .transpose()?, ); } "width" => { builder = builder.set_width( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "xPosition" => { builder = builder.set_x_position( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "yPosition" => { builder = builder.set_y_position( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_embedded_destination_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::EmbeddedDestinationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::EmbeddedDestinationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "destination608ChannelNumber" => { builder = builder.set_destination608_channel_number( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "destination708ServiceNumber" => { builder = builder.set_destination708_service_number( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_imsc_destination_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ImscDestinationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ImscDestinationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "stylePassthrough" => { builder = builder.set_style_passthrough( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ImscStylePassthrough::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_scc_destination_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::SccDestinationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::SccDestinationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "framerate" => { builder = builder.set_framerate( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::SccDestinationFramerate::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_srt_destination_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::SrtDestinationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::SrtDestinationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "stylePassthrough" => { builder = builder.set_style_passthrough( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::SrtStylePassthrough::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_teletext_destination_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TeletextDestinationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TeletextDestinationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "pageNumber" => { builder = builder.set_page_number( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "pageTypes" => { builder = builder.set_page_types( crate::json_deser::deser_list___list_of_teletext_page_type( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_ttml_destination_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TtmlDestinationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TtmlDestinationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "stylePassthrough" => { builder = builder.set_style_passthrough( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::TtmlStylePassthrough::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_webvtt_destination_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::WebvttDestinationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::WebvttDestinationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "stylePassthrough" => { builder = builder.set_style_passthrough( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::WebvttStylePassthrough::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_av1_qvbr_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Av1QvbrSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Av1QvbrSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "qvbrQualityLevel" => { builder = builder.set_qvbr_quality_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "qvbrQualityLevelFineTune" => { builder = builder.set_qvbr_quality_level_fine_tune( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_avc_intra_uhd_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AvcIntraUhdSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AvcIntraUhdSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "qualityTuningLevel" => { builder = builder.set_quality_tuning_level( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AvcIntraUhdQualityTuningLevel::from( u.as_ref(), ) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_h264_qvbr_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::H264QvbrSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::H264QvbrSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "maxAverageBitrate" => { builder = builder.set_max_average_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "qvbrQualityLevel" => { builder = builder.set_qvbr_quality_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "qvbrQualityLevelFineTune" => { builder = builder.set_qvbr_quality_level_fine_tune( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_h265_qvbr_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::H265QvbrSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::H265QvbrSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "maxAverageBitrate" => { builder = builder.set_max_average_bitrate( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "qvbrQualityLevel" => { builder = builder.set_qvbr_quality_level( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "qvbrQualityLevelFineTune" => { builder = builder.set_qvbr_quality_level_fine_tune( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_xavc4k_intra_cbg_profile_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Xavc4kIntraCbgProfileSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Xavc4kIntraCbgProfileSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "xavcClass" => { builder = builder.set_xavc_class( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Xavc4kIntraCbgProfileClass::from( u.as_ref(), ) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_xavc4k_intra_vbr_profile_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Xavc4kIntraVbrProfileSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Xavc4kIntraVbrProfileSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "xavcClass" => { builder = builder.set_xavc_class( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Xavc4kIntraVbrProfileClass::from( u.as_ref(), ) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_xavc4k_profile_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Xavc4kProfileSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Xavc4kProfileSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "bitrateClass" => { builder = builder.set_bitrate_class( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Xavc4kProfileBitrateClass::from( u.as_ref(), ) }) }) .transpose()?, ); } "codecProfile" => { builder = builder.set_codec_profile( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Xavc4kProfileCodecProfile::from( u.as_ref(), ) }) }) .transpose()?, ); } "flickerAdaptiveQuantization" => { builder = builder.set_flicker_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcFlickerAdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } "gopBReference" => { builder = builder.set_gop_b_reference( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcGopBReference::from(u.as_ref()) }) }) .transpose()?, ); } "gopClosedCadence" => { builder = builder.set_gop_closed_cadence( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "hrdBufferSize" => { builder = builder.set_hrd_buffer_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "qualityTuningLevel" => { builder = builder.set_quality_tuning_level( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::Xavc4kProfileQualityTuningLevel::from( u.as_ref(), ) }) }) .transpose()?, ); } "slices" => { builder = builder.set_slices( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_xavc_hd_intra_cbg_profile_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::XavcHdIntraCbgProfileSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::XavcHdIntraCbgProfileSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "xavcClass" => { builder = builder.set_xavc_class( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcHdIntraCbgProfileClass::from( u.as_ref(), ) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_xavc_hd_profile_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::XavcHdProfileSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::XavcHdProfileSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "bitrateClass" => { builder = builder.set_bitrate_class( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcHdProfileBitrateClass::from( u.as_ref(), ) }) }) .transpose()?, ); } "flickerAdaptiveQuantization" => { builder = builder.set_flicker_adaptive_quantization( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcFlickerAdaptiveQuantization::from( u.as_ref(), ) }) }) .transpose()?, ); } "gopBReference" => { builder = builder.set_gop_b_reference( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcGopBReference::from(u.as_ref()) }) }) .transpose()?, ); } "gopClosedCadence" => { builder = builder.set_gop_closed_cadence( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "hrdBufferSize" => { builder = builder.set_hrd_buffer_size( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "interlaceMode" => { builder = builder.set_interlace_mode( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcInterlaceMode::from(u.as_ref()) }) }) .transpose()?, ); } "qualityTuningLevel" => { builder = builder.set_quality_tuning_level( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcHdProfileQualityTuningLevel::from( u.as_ref(), ) }) }) .transpose()?, ); } "slices" => { builder = builder.set_slices( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "telecine" => { builder = builder.set_telecine( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::XavcHdProfileTelecine::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_dolby_vision_level6_metadata<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::DolbyVisionLevel6Metadata>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::DolbyVisionLevel6Metadata::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "maxCll" => { builder = builder.set_max_cll( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "maxFall" => { builder = builder.set_max_fall( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_noise_reducer_filter_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::NoiseReducerFilterSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::NoiseReducerFilterSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "strength" => { builder = builder.set_strength( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_noise_reducer_spatial_filter_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::NoiseReducerSpatialFilterSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::NoiseReducerSpatialFilterSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "postFilterSharpenStrength" => { builder = builder.set_post_filter_sharpen_strength( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "speed" => { builder = builder.set_speed( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "strength" => { builder = builder.set_strength( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_noise_reducer_temporal_filter_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::NoiseReducerTemporalFilterSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::NoiseReducerTemporalFilterSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "aggressiveMode" => { builder = builder.set_aggressive_mode( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "postTemporalSharpening" => { builder = builder.set_post_temporal_sharpening( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::NoiseFilterPostTemporalSharpening::from( u.as_ref(), ) }) }) .transpose()?, ); } "speed" => { builder = builder.set_speed( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "strength" => { builder = builder.set_strength( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_nex_guard_file_marker_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::NexGuardFileMarkerSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::NexGuardFileMarkerSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "license" => { builder = builder.set_license( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "payload" => { builder = builder.set_payload( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "preset" => { builder = builder.set_preset( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "strength" => { builder = builder.set_strength( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::WatermarkingStrength::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of__string_min1<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<std::string::String>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_hls_rendition_group_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::HlsRenditionGroupSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::HlsRenditionGroupSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "renditionGroupId" => { builder = builder.set_rendition_group_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "renditionLanguageCode" => { builder = builder.set_rendition_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::LanguageCode::from(u.as_ref())) }) .transpose()?, ); } "renditionName" => { builder = builder.set_rendition_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of__integer_min1_max2147483647<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<i32>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = smithy_json::deserialize::token::expect_number_or_null(tokens.next())? .map(|v| v.to_i32()); if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_caption_source_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::CaptionSourceSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::CaptionSourceSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "ancillarySourceSettings" => { builder = builder.set_ancillary_source_settings( crate::json_deser::deser_structure_ancillary_source_settings( tokens, )?, ); } "dvbSubSourceSettings" => { builder = builder.set_dvb_sub_source_settings( crate::json_deser::deser_structure_dvb_sub_source_settings( tokens, )?, ); } "embeddedSourceSettings" => { builder = builder.set_embedded_source_settings( crate::json_deser::deser_structure_embedded_source_settings( tokens, )?, ); } "fileSourceSettings" => { builder = builder.set_file_source_settings( crate::json_deser::deser_structure_file_source_settings( tokens, )?, ); } "sourceType" => { builder = builder.set_source_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CaptionSourceType::from(u.as_ref()) }) }) .transpose()?, ); } "teletextSourceSettings" => { builder = builder.set_teletext_source_settings( crate::json_deser::deser_structure_teletext_source_settings( tokens, )?, ); } "trackSourceSettings" => { builder = builder.set_track_source_settings( crate::json_deser::deser_structure_track_source_settings( tokens, )?, ); } "webvttHlsSourceSettings" => { builder = builder.set_webvtt_hls_source_settings( crate::json_deser::deser_structure_webvtt_hls_source_settings( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_insertable_image<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::InsertableImage>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::InsertableImage::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "duration" => { builder = builder.set_duration( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "fadeIn" => { builder = builder.set_fade_in( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "fadeOut" => { builder = builder.set_fade_out( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "height" => { builder = builder.set_height( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "imageInserterInput" => { builder = builder.set_image_inserter_input( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "imageX" => { builder = builder.set_image_x( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "imageY" => { builder = builder.set_image_y( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "layer" => { builder = builder.set_layer( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "opacity" => { builder = builder.set_opacity( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "startTime" => { builder = builder.set_start_time( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "width" => { builder = builder.set_width( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_cmaf_additional_manifest<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::vec::Vec<crate::model::CmafAdditionalManifest>>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_cmaf_additional_manifest(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_destination_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::DestinationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::DestinationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "s3Settings" => { builder = builder.set_s3_settings( crate::json_deser::deser_structure_s3_destination_settings( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_cmaf_encryption_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::CmafEncryptionSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::CmafEncryptionSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "constantInitializationVector" => { builder = builder.set_constant_initialization_vector( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "encryptionMethod" => { builder = builder.set_encryption_method( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafEncryptionType::from(u.as_ref()) }) }) .transpose()?, ); } "initializationVectorInManifest" => { builder = builder.set_initialization_vector_in_manifest( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafInitializationVectorInManifest::from( u.as_ref(), ) }) }) .transpose()?, ); } "spekeKeyProvider" => { builder = builder.set_speke_key_provider( crate::json_deser::deser_structure_speke_key_provider_cmaf( tokens, )?, ); } "staticKeyProvider" => { builder = builder.set_static_key_provider( crate::json_deser::deser_structure_static_key_provider(tokens)?, ); } "type" => { builder = builder.set_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::CmafKeyProviderType::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_dash_additional_manifest<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::vec::Vec<crate::model::DashAdditionalManifest>>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_dash_additional_manifest(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_dash_iso_encryption_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::DashIsoEncryptionSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::DashIsoEncryptionSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "playbackDeviceCompatibility" => { builder = builder.set_playback_device_compatibility( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::DashIsoPlaybackDeviceCompatibility::from( u.as_ref(), ) }) }) .transpose()?, ); } "spekeKeyProvider" => { builder = builder.set_speke_key_provider( crate::json_deser::deser_structure_speke_key_provider(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_hls_ad_markers<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::HlsAdMarkers>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::HlsAdMarkers::from(u.as_ref())) }) .transpose()?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_hls_additional_manifest<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::vec::Vec<crate::model::HlsAdditionalManifest>>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_hls_additional_manifest(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_hls_caption_language_mapping<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::vec::Vec<crate::model::HlsCaptionLanguageMapping>>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_hls_caption_language_mapping( tokens, )?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_hls_encryption_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::HlsEncryptionSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::HlsEncryptionSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "constantInitializationVector" => { builder = builder.set_constant_initialization_vector( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "encryptionMethod" => { builder = builder.set_encryption_method( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsEncryptionType::from(u.as_ref()) }) }) .transpose()?, ); } "initializationVectorInManifest" => { builder = builder.set_initialization_vector_in_manifest( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsInitializationVectorInManifest::from( u.as_ref(), ) }) }) .transpose()?, ); } "offlineEncrypted" => { builder = builder.set_offline_encrypted( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsOfflineEncrypted::from(u.as_ref()) }) }) .transpose()?, ); } "spekeKeyProvider" => { builder = builder.set_speke_key_provider( crate::json_deser::deser_structure_speke_key_provider(tokens)?, ); } "staticKeyProvider" => { builder = builder.set_static_key_provider( crate::json_deser::deser_structure_static_key_provider(tokens)?, ); } "type" => { builder = builder.set_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsKeyProviderType::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_ms_smooth_additional_manifest<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::vec::Vec<crate::model::MsSmoothAdditionalManifest>>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_ms_smooth_additional_manifest( tokens, )?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_ms_smooth_encryption_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::MsSmoothEncryptionSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::MsSmoothEncryptionSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "spekeKeyProvider" => { builder = builder.set_speke_key_provider( crate::json_deser::deser_structure_speke_key_provider(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_caption_description<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::CaptionDescription>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_caption_description(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_output_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::OutputSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::OutputSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "hlsSettings" => { builder = builder.set_hls_settings( crate::json_deser::deser_structure_hls_settings(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_output_channel_mapping<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::vec::Vec<crate::model::OutputChannelMapping>>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_output_channel_mapping(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of_teletext_page_type<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::TeletextPageType>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::TeletextPageType::from(u.as_ref())) }) .transpose()?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_ancillary_source_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AncillarySourceSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::AncillarySourceSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "convert608To708" => { builder = builder.set_convert608_to708( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AncillaryConvert608To708::from(u.as_ref()) }) }) .transpose()?, ); } "sourceAncillaryChannelNumber" => { builder = builder.set_source_ancillary_channel_number( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "terminateCaptions" => { builder = builder.set_terminate_captions( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::AncillaryTerminateCaptions::from( u.as_ref(), ) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_dvb_sub_source_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::DvbSubSourceSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::DvbSubSourceSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "pid" => { builder = builder.set_pid( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_embedded_source_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::EmbeddedSourceSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::EmbeddedSourceSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "convert608To708" => { builder = builder.set_convert608_to708( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::EmbeddedConvert608To708::from(u.as_ref()) }) }) .transpose()?, ); } "source608ChannelNumber" => { builder = builder.set_source608_channel_number( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "source608TrackNumber" => { builder = builder.set_source608_track_number( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "terminateCaptions" => { builder = builder.set_terminate_captions( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::EmbeddedTerminateCaptions::from( u.as_ref(), ) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_file_source_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::FileSourceSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::FileSourceSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "convert608To708" => { builder = builder.set_convert608_to708( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::FileSourceConvert608To708::from( u.as_ref(), ) }) }) .transpose()?, ); } "framerate" => { builder = builder.set_framerate( crate::json_deser::deser_structure_caption_source_framerate( tokens, )?, ); } "sourceFile" => { builder = builder.set_source_file( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "timeDelta" => { builder = builder.set_time_delta( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_teletext_source_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TeletextSourceSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TeletextSourceSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "pageNumber" => { builder = builder.set_page_number( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_track_source_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TrackSourceSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TrackSourceSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "trackNumber" => { builder = builder.set_track_number( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_webvtt_hls_source_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::WebvttHlsSourceSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::WebvttHlsSourceSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "renditionGroupId" => { builder = builder.set_rendition_group_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "renditionLanguageCode" => { builder = builder.set_rendition_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::LanguageCode::from(u.as_ref())) }) .transpose()?, ); } "renditionName" => { builder = builder.set_rendition_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_cmaf_additional_manifest<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::CmafAdditionalManifest>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::CmafAdditionalManifest::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "manifestNameModifier" => { builder = builder.set_manifest_name_modifier( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "selectedOutputs" => { builder = builder.set_selected_outputs( crate::json_deser::deser_list___list_of__string_min1(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_s3_destination_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::S3DestinationSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::S3DestinationSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "accessControl" => { builder = builder.set_access_control( crate::json_deser::deser_structure_s3_destination_access_control(tokens)? ); } "encryption" => { builder = builder.set_encryption( crate::json_deser::deser_structure_s3_encryption_settings( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_speke_key_provider_cmaf<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::SpekeKeyProviderCmaf>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::SpekeKeyProviderCmaf::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "certificateArn" => { builder = builder.set_certificate_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "dashSignaledSystemIds" => { builder = builder.set_dash_signaled_system_ids( crate::json_deser::deser_list___list_of__string_min36_max36_pattern09a_faf809a_faf409a_faf409a_faf409a_faf12(tokens)? ); } "hlsSignaledSystemIds" => { builder = builder.set_hls_signaled_system_ids( crate::json_deser::deser_list___list_of__string_min36_max36_pattern09a_faf809a_faf409a_faf409a_faf409a_faf12(tokens)? ); } "resourceId" => { builder = builder.set_resource_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "url" => { builder = builder.set_url( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_static_key_provider<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::StaticKeyProvider>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::StaticKeyProvider::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "keyFormat" => { builder = builder.set_key_format( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "keyFormatVersions" => { builder = builder.set_key_format_versions( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "staticKeyValue" => { builder = builder.set_static_key_value( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "url" => { builder = builder.set_url( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_dash_additional_manifest<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::DashAdditionalManifest>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::DashAdditionalManifest::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "manifestNameModifier" => { builder = builder.set_manifest_name_modifier( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "selectedOutputs" => { builder = builder.set_selected_outputs( crate::json_deser::deser_list___list_of__string_min1(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_speke_key_provider<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::SpekeKeyProvider>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::SpekeKeyProvider::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "certificateArn" => { builder = builder.set_certificate_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "resourceId" => { builder = builder.set_resource_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "systemIds" => { builder = builder.set_system_ids( crate::json_deser::deser_list___list_of__string_pattern09a_faf809a_faf409a_faf409a_faf409a_faf12(tokens)? ); } "url" => { builder = builder.set_url( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_hls_additional_manifest<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::HlsAdditionalManifest>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::HlsAdditionalManifest::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "manifestNameModifier" => { builder = builder.set_manifest_name_modifier( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "selectedOutputs" => { builder = builder.set_selected_outputs( crate::json_deser::deser_list___list_of__string_min1(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_hls_caption_language_mapping<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::HlsCaptionLanguageMapping>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::HlsCaptionLanguageMapping::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "captionChannel" => { builder = builder.set_caption_channel( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "customLanguageCode" => { builder = builder.set_custom_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "languageCode" => { builder = builder.set_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::LanguageCode::from(u.as_ref())) }) .transpose()?, ); } "languageDescription" => { builder = builder.set_language_description( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_ms_smooth_additional_manifest<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::MsSmoothAdditionalManifest>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::MsSmoothAdditionalManifest::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "manifestNameModifier" => { builder = builder.set_manifest_name_modifier( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "selectedOutputs" => { builder = builder.set_selected_outputs( crate::json_deser::deser_list___list_of__string_min1(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_caption_description<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::CaptionDescription>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::CaptionDescription::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "captionSelectorName" => { builder = builder.set_caption_selector_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "customLanguageCode" => { builder = builder.set_custom_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "destinationSettings" => { builder = builder.set_destination_settings( crate::json_deser::deser_structure_caption_destination_settings(tokens)? ); } "languageCode" => { builder = builder.set_language_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::LanguageCode::from(u.as_ref())) }) .transpose()?, ); } "languageDescription" => { builder = builder.set_language_description( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_hls_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::HlsSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::HlsSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "audioGroupId" => { builder = builder.set_audio_group_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "audioOnlyContainer" => { builder = builder.set_audio_only_container( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsAudioOnlyContainer::from(u.as_ref()) }) }) .transpose()?, ); } "audioRenditionSets" => { builder = builder.set_audio_rendition_sets( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "audioTrackType" => { builder = builder.set_audio_track_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsAudioTrackType::from(u.as_ref()) }) }) .transpose()?, ); } "descriptiveVideoServiceFlag" => { builder = builder.set_descriptive_video_service_flag( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsDescriptiveVideoServiceFlag::from( u.as_ref(), ) }) }) .transpose()?, ); } "iFrameOnlyManifest" => { builder = builder.set_i_frame_only_manifest( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HlsIFrameOnlyManifest::from(u.as_ref()) }) }) .transpose()?, ); } "segmentModifier" => { builder = builder.set_segment_modifier( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_output_channel_mapping<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::OutputChannelMapping>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::OutputChannelMapping::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "inputChannels" => { builder = builder.set_input_channels( crate::json_deser::deser_list___list_of__integer_min_negative60_max6(tokens)? ); } "inputChannelsFineTune" => { builder = builder.set_input_channels_fine_tune( crate::json_deser::deser_list___list_of__double_min_negative60_max6(tokens)? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_caption_source_framerate<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::CaptionSourceFramerate>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::CaptionSourceFramerate::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "framerateDenominator" => { builder = builder.set_framerate_denominator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } "framerateNumerator" => { builder = builder.set_framerate_numerator( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_s3_destination_access_control<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::S3DestinationAccessControl>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::S3DestinationAccessControl::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "cannedAcl" => { builder = builder.set_canned_acl( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::S3ObjectCannedAcl::from(u.as_ref()) }) }) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_s3_encryption_settings<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::S3EncryptionSettings>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::S3EncryptionSettings::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "encryptionType" => { builder = builder.set_encryption_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::S3ServerSideEncryptionType::from( u.as_ref(), ) }) }) .transpose()?, ); } "kmsEncryptionContext" => { builder = builder.set_kms_encryption_context( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "kmsKeyArn" => { builder = builder.set_kms_key_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of__string_min36_max36_pattern09a_faf809a_faf409a_faf409a_faf409a_faf12< 'a, I, >( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<std::string::String>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of__string_pattern09a_faf809a_faf409a_faf409a_faf409a_faf12<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<std::string::String>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of__integer_min_negative60_max6<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<i32>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = smithy_json::deserialize::token::expect_number_or_null(tokens.next())? .map(|v| v.to_i32()); if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list___list_of__double_min_negative60_max6<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<f64>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = smithy_json::deserialize::token::expect_number_or_null(tokens.next())? .map(|v| v.to_f64()); if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } }
use std::cmp::{max, min}; use std::collections::{HashMap, HashSet}; use itertools::Itertools; use whiteread::parse_line; // dp // https://atcoder.jp/contests/joi2013yo/tasks/joi2013yo_d fn main() { let (d, n): (usize, usize) = parse_line().unwrap(); let mut tt: Vec<usize> = vec![]; for _ in 0..d { tt.push(parse_line().unwrap()); } let mut fukus: Vec<(usize, usize, usize)> = vec![]; for _ in 0..n { fukus.push(parse_line().unwrap()); } let mut dp: Vec<Vec<Option<usize>>> = vec![vec![None; n]; d + 1]; for j in 0..n { for one in 0..n { if fukus[one].0 <= tt[0] && tt[0] <= fukus[one].1 && fukus[j].0 <= tt[1] && tt[1] <= fukus[j].1 { dp[2][j] = Some(max( dp[2][j].unwrap_or(0), (fukus[one].2 as isize - fukus[j].2 as isize).abs() as usize, )); } } } for i in 3..=d { for j in 0..n { for one in 0..n { if fukus[j].0 <= tt[i - 1] && tt[i - 1] <= fukus[j].1 && dp[i - 1][one].is_some() { dp[i][j] = Some(max( dp[i][j].unwrap_or(0), dp[i - 1][one].unwrap() + (fukus[one].2 as isize - fukus[j].2 as isize).abs() as usize, )); } } } } println!("{}", dp[d].iter().map(|a| a.unwrap_or(0)).max().unwrap()); }
use tree_walk_interpreter::interpreter::Interpreter; use criterion::{black_box, criterion_group, criterion_main, Criterion}; use parser::lexer::Lexer; use parser::parser::Parser; use parser::resolver::Resolver; use parser::types::Pass; const PROGRAM: &str = " fun fibonacci(a) { if (a < 2) return a; return fibonacci(a-1) + fibonacci(a-2); } fibonacci"; fn fibonacci(extra: usize) { let program = format!("{}({});", PROGRAM, extra); let mut lexer = Lexer::new(program.as_str(), "stdin"); let ss = lexer .parse() .and_then(|ts| { let parser = Parser::new(ts.into_iter().peekable()); parser.parse() }).unwrap(); let mut resolver = Resolver::new(); let locals = resolver.run(&ss).unwrap(); let paths = vec![]; let mut interpreter = Interpreter::new(&paths, ""); interpreter.locals = locals; interpreter.run(&ss).unwrap(); } fn criterion_benchmark(c: &mut Criterion) { c.bench_function("fibonacci 5", |b| { b.iter(|| fibonacci(black_box(5))) }); c.bench_function("fibonacci 10", |b| { b.iter(|| fibonacci(black_box(10))) }); c.bench_function("fibonacci 20", |b| { b.iter(|| fibonacci(black_box(20))) }); c.bench_function("fibonacci 40", |b| { b.iter(|| fibonacci(black_box(20))) }); } criterion_group!(benches, criterion_benchmark); criterion_main!(benches);
use std::fs; use std::fs::OpenOptions; use std::io::prelude::*; const SOLUTION: &str = "use crate::AoCDay; pub struct Code; impl AoCDay for Code { fn part1(&self, _input: &mut dyn std::io::Read, _extra_argss: &[String]) -> String { todo!() } fn part2(&self, _input: &mut dyn std::io::Read, _extra_args: &[String]) -> String { todo!() } } "; fn main() { println!("cargo:rerun-if-changed=build.rs"); add_year_in_init(); session_and_input_dir(); set_up_solution_files(); set_up_lib_file(); set_up_day_file(); } fn set_up_solution_files() { fs::create_dir_all("src/solutions/").expect("Cannot create solution directory"); for day in 1..=25 { let path = format!("src/solutions/day{}.rs", day); fs::write(path, SOLUTION).expect("Failed to create solution file"); } } fn set_up_lib_file() { let mut file = OpenOptions::new() .append(true) .open("src/lib.rs") .expect("Failed to open src/lib.rs"); writeln!(file, "\npub mod solutions {{").expect("Failed to define solution module"); for day in 1..=25 { writeln!(file, " pub mod day{};", day).expect("Failed to define solution module"); } writeln!( file, "}} pub use solutions::*;" ) .expect("Failed to define solution module"); } fn set_up_day_file() { let contents = fs::read_to_string("src/day.rs").expect("src/day.rs cannot be opened"); let mut match_code = String::from("match self.day.get() {\n"); for day in 1..=25 { match_code.push_str(&format!("{0} => &day{0}::Code,\n", day)) } match_code.push_str("_ => unreachable!(),\n}"); let contents = contents.replace("/* Add match code */", &match_code); fs::write("src/day.rs", contents).expect("Cannot write to src/day.rs"); } fn session_and_input_dir() { let session = option_env!("AOC_SESSION").unwrap_or_else(|| { println!("NOTE: Session key needs to be added in .env"); "" }); let input_dir = option_env!("AOC_INPUT").unwrap_or_else(|| { println!("Note: Using `inputs` directory in project root"); "inputs" }); std::fs::create_dir_all(input_dir).expect("Failed to create input directory"); let env = format!("AOC_SESSION={}\nAOC_INPUT={}", session, input_dir); fs::write(".env", env).expect("Failed to create .env file"); } fn add_year_in_init() { // let year = env!("AOC_YEAR"); let year = "2020"; assert!( year.chars().all(char::is_numeric), "Year should be a number" ); let contents = fs::read_to_string("src/init.rs").expect("Need to open src/init.rs"); let contents = contents.replace("0xFFFF", &format!("{}", year)); fs::write("src/init.rs", contents).expect("Cannot write to src/init.rs"); }
use bit_set::BitSet; use itertools::Itertools; use board::group_access::GroupAccess; use board::stones::grouprc::GoGroupRc; use board::stones::stone::Stone; use graph_lib::topology::Topology; pub struct Go<'a, T: GroupAccess> { state: &'a T } impl<'a, T: GroupAccess> Go<'a, T> { pub fn new(state: &'a T) -> Go<'a, T> { Go { state } } } impl<'a, T: GroupAccess> Go<'a, T> { pub fn adjacent_cells(&self, cells: &BitSet) -> BitSet { let mut adjacents = BitSet::new(); for c in cells.iter() { adjacents.union_with(&self.state.goban().edges(c)); } adjacents.difference_with(cells); adjacents } pub fn count_stones(&self, stone: Stone) -> usize { self.state.groups_by_stone(stone) .iter() .map(|g| g.borrow().stones()) .sum() } fn count_stones2(&self, stone: Stone) -> usize { self.state.goban().vertices().iter() .map(|c| self.state.stone_at(c)) .filter(|&s| s == stone) .count() } pub fn count_groups(&self, stone: Stone) -> usize { self.state.groups_by_stone(stone).len() } pub fn count_territory(&self, stone: Stone) -> usize { match stone { Stone::None => 0, _ => self.state.groups_by_stone(Stone::None) .iter() .filter(|&g| self.get_owner(g.clone()) == stone) .map(|g| g.borrow().stones()) .sum() } } pub fn get_owner(&self, group: GoGroupRc) -> Stone { assert!(group.borrow().stone == Stone::None); let adjacents = self.adjacent_cells(&group.borrow().cells); let border = adjacents.iter() .map(|c| self.state.stone_at(c)) .unique() .collect_vec(); let white = border.contains(&Stone::White); let black = border.contains(&Stone::Black); let owner = if white && black { Stone::None } else if white { Stone::White } else { Stone::Black }; owner } }
use seed::{prelude::*, *}; pub fn view<Ms>() -> Node<Ms> { div!["not found"] }
#[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Dynset { pub data: Data, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Data { #[serde(rename = "TrendingSet")] pub trending_set: Option<TrendingSet>, #[serde(rename = "CuratedSet")] pub curated_set: Option<CuratedSet>, #[serde(rename = "PersonalizedCuratedSet")] pub personalized_curated_set: Option<PersonalizedCuratedSet>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct TrendingSet { #[serde(rename = "contentClass")] pub content_class: String, #[serde(rename = "experimentToken")] pub experiment_token: String, pub items: Vec<Item>, pub meta: Meta, #[serde(rename = "setId")] pub set_id: String, pub text: Text2, #[serde(rename = "type")] pub type_field: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Item { #[serde(rename = "contentId")] pub content_id: String, #[serde(rename = "callToAction")] pub call_to_action: ::serde_json::Value, #[serde(rename = "currentAvailability")] pub current_availability: CurrentAvailability, #[serde(rename = "encodedSeriesId")] pub encoded_series_id: Option<String>, pub image: Image, #[serde(rename = "seriesId")] pub series_id: Option<String>, pub text: Text, #[serde(rename = "textExperienceId")] pub text_experience_id: Option<String>, pub tags: Vec<Tag>, #[serde(rename = "mediaRights")] pub media_rights: MediaRights, pub ratings: Vec<Rating>, pub releases: Vec<Release>, #[serde(rename = "type")] pub type_field: String, #[serde(rename = "videoArt")] pub video_art: Vec<VideoArt>, #[serde(rename = "contentType")] pub content_type: Option<String>, #[serde(rename = "episodeNumber")] pub episode_number: Option<::serde_json::Value>, #[serde(rename = "episodeSequenceNumber")] pub episode_sequence_number: Option<::serde_json::Value>, #[serde(rename = "episodeSeriesSequenceNumber")] pub episode_series_sequence_number: Option<::serde_json::Value>, pub family: Option<Family>, #[serde(default)] pub groups: Vec<Group>, #[serde(rename = "internalTitle")] pub internal_title: Option<String>, #[serde(rename = "mediaMetadata")] pub media_metadata: Option<MediaMetadata2>, #[serde(rename = "originalLanguage")] pub original_language: Option<String>, #[serde(rename = "programId")] pub program_id: Option<String>, #[serde(rename = "programType")] pub program_type: Option<String>, #[serde(rename = "seasonId")] pub season_id: Option<::serde_json::Value>, #[serde(rename = "seasonSequenceNumber")] pub season_sequence_number: Option<::serde_json::Value>, #[serde(rename = "targetLanguage")] pub target_language: Option<String>, #[serde(rename = "videoId")] pub video_id: Option<String>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct CurrentAvailability { pub region: String, #[serde(rename = "kidsMode")] pub kids_mode: Option<bool>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Image { pub background_details: Option<BackgroundDetails>, pub tile: Tile, pub hero_tile: HeroTile, pub background: Background, pub title_treatment: TitleTreatment, pub hero_collection: HeroCollection, pub title_treatment_layer: TitleTreatmentLayer, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct BackgroundDetails { #[serde(rename = "1.78")] pub n178: N178, #[serde(rename = "1.33")] pub n133: N133, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N178 { pub program: Option<Program>, pub series: Option<Series>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program { pub default: Default, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series { pub default: Default2, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default2 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N133 { pub program: Option<Program2>, pub series: Option<Series2>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program2 { pub default: Default3, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default3 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series2 { pub default: Default4, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default4 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Tile { #[serde(rename = "2.29")] pub n229: Option<N229>, #[serde(rename = "0.75")] pub n075: N075, #[serde(rename = "1.00")] pub n100: Option<N100>, #[serde(rename = "1.78")] pub n178: N1782, #[serde(rename = "1.33")] pub n133: Option<N1332>, #[serde(rename = "0.71")] pub n071: N071, #[serde(rename = "0.67")] pub n067: Option<N067>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N229 { pub program: Option<Program3>, pub series: Option<Series3>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program3 { pub default: Default5, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default5 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series3 { pub default: Default6, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default6 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N075 { pub series: Option<Series4>, pub program: Option<Program4>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series4 { pub default: Default7, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default7 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program4 { pub default: Default8, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default8 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N100 { pub series: Option<Series5>, pub program: Option<Program5>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series5 { pub default: Default9, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default9 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program5 { pub default: Default10, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default10 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1782 { pub series: Option<Series6>, pub program: Option<Program6>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series6 { pub default: Default11, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default11 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program6 { pub default: Default12, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default12 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1332 { pub program: Option<Program7>, pub series: Option<Series7>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program7 { pub default: Default13, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default13 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series7 { pub default: Default14, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default14 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N071 { pub series: Option<Series8>, pub program: Option<Program8>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series8 { pub default: Default15, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default15 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program8 { pub default: Default16, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default16 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N067 { pub program: Option<Program9>, pub series: Option<Series9>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program9 { pub default: Default17, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default17 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series9 { pub default: Default18, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default18 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct HeroTile { #[serde(rename = "3.91")] pub n391: N391, #[serde(rename = "3.00")] pub n300: N300, #[serde(rename = "1.78")] pub n178: N1783, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N391 { pub series: Option<Series10>, pub program: Option<Program10>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series10 { pub default: Default19, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default19 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program10 { pub default: Default20, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default20 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N300 { pub series: Option<Series11>, pub program: Option<Program11>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series11 { pub default: Default21, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default21 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program11 { pub default: Default22, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default22 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1783 { pub series: Option<Series12>, pub program: Option<Program12>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series12 { pub default: Default23, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default23 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program12 { pub default: Default24, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default24 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Background { #[serde(rename = "1.78")] pub n178: N1784, #[serde(rename = "2.89")] pub n289: Option<N289>, #[serde(rename = "1.33")] pub n133: Option<N1333>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1784 { pub series: Option<Series13>, pub program: Option<Program13>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series13 { pub default: Default25, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default25 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program13 { pub default: Default26, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default26 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N289 { pub program: Option<Program14>, pub series: Option<Series14>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program14 { pub default: Default27, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default27 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series14 { pub default: Default28, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default28 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1333 { pub series: Option<Series15>, pub program: Option<Program15>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series15 { pub default: Default29, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default29 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program15 { pub default: Default30, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default30 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct TitleTreatment { #[serde(rename = "3.32")] pub n332: N332, #[serde(rename = "1.78")] pub n178: N1785, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N332 { pub series: Option<Series16>, pub program: Option<Program16>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series16 { pub default: Default31, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default31 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program16 { pub default: Default32, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default32 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1785 { pub series: Option<Series17>, pub program: Option<Program17>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series17 { pub default: Default33, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default33 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program17 { pub default: Default34, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default34 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct HeroCollection { #[serde(rename = "1.78")] pub n178: N1786, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1786 { pub series: Option<Series18>, pub program: Option<Program18>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series18 { pub default: Default35, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default35 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program18 { pub default: Default36, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default36 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct TitleTreatmentLayer { #[serde(rename = "3.00")] pub n300: N3002, #[serde(rename = "3.91")] pub n391: N3912, #[serde(rename = "1.78")] pub n178: N1787, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N3002 { pub series: Option<Series19>, pub program: Option<Program19>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series19 { pub default: Default37, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default37 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program19 { pub default: Default38, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default38 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N3912 { pub series: Option<Series20>, pub program: Option<Program20>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series20 { pub default: Default39, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default39 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program20 { pub default: Default40, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default40 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1787 { pub series: Option<Series21>, pub program: Option<Program21>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series21 { pub default: Default41, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default41 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program21 { pub default: Default42, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default42 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Text { pub title: Title, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Title { pub slug: Slug, pub full: Full, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Slug { pub series: Option<Series22>, pub program: Option<Program22>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series22 { pub default: Default43, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default43 { pub content: String, pub language: String, #[serde(rename = "sourceEntity")] pub source_entity: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program22 { pub default: Default44, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default44 { pub content: String, pub language: String, #[serde(rename = "sourceEntity")] pub source_entity: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Full { pub series: Option<Series23>, pub program: Option<Program23>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series23 { pub default: Default45, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default45 { pub content: String, pub language: String, #[serde(rename = "sourceEntity")] pub source_entity: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program23 { pub default: Default46, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default46 { pub content: String, pub language: String, #[serde(rename = "sourceEntity")] pub source_entity: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Tag { #[serde(rename = "displayName")] pub display_name: ::serde_json::Value, #[serde(rename = "type")] pub type_field: String, pub value: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct MediaRights { #[serde(rename = "downloadBlocked")] pub download_blocked: bool, #[serde(rename = "pconBlocked")] pub pcon_blocked: bool, #[serde(default)] pub violations: Vec<::serde_json::Value>, pub rewind: Option<bool>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Rating { pub advisories: Vec<::serde_json::Value>, pub description: Option<String>, pub system: String, pub value: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Release { #[serde(rename = "releaseDate")] pub release_date: String, #[serde(rename = "releaseType")] pub release_type: String, #[serde(rename = "releaseYear")] pub release_year: i64, pub territory: ::serde_json::Value, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct VideoArt { #[serde(rename = "mediaMetadata")] pub media_metadata: MediaMetadata, pub purpose: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct MediaMetadata { pub urls: Vec<Url>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Url { pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Family { #[serde(rename = "encodedFamilyId")] pub encoded_family_id: String, #[serde(rename = "familyId")] pub family_id: String, pub parent: bool, #[serde(rename = "parentRef")] pub parent_ref: ParentRef, #[serde(rename = "sequenceNumber")] pub sequence_number: ::serde_json::Value, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct ParentRef { #[serde(rename = "encodedSeriesId")] pub encoded_series_id: ::serde_json::Value, #[serde(rename = "programId")] pub program_id: String, #[serde(rename = "seasonId")] pub season_id: Option<::serde_json::Value>, #[serde(rename = "seriesId")] pub series_id: Option<::serde_json::Value>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Group { pub name: String, #[serde(rename = "partnerGroupId")] pub partner_group_id: String, #[serde(rename = "type")] pub type_field: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct MediaMetadata2 { pub format: String, #[serde(rename = "mediaId")] pub media_id: String, pub phase: String, #[serde(rename = "playbackUrls")] pub playback_urls: Vec<PlaybackUrl>, #[serde(rename = "productType")] pub product_type: String, #[serde(rename = "runtimeMillis")] pub runtime_millis: i64, pub state: String, #[serde(rename = "type")] pub type_field: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct PlaybackUrl { pub rel: String, pub href: String, pub templated: bool, pub params: Vec<Param>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Param { pub name: String, pub description: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Meta { pub hits: i64, pub offset: i64, pub page_size: i64, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Text2 { pub title: Title2, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Title2 { pub full: Full2, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Full2 { pub set: Set, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Set { pub default: Default47, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default47 { pub content: String, pub language: String, #[serde(rename = "sourceEntity")] pub source_entity: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct CuratedSet { #[serde(rename = "contentClass")] pub content_class: String, pub items: Vec<Item2>, pub meta: Meta2, #[serde(rename = "setId")] pub set_id: String, pub text: Text4, #[serde(rename = "type")] pub type_field: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Item2 { #[serde(rename = "contentId")] pub content_id: String, #[serde(rename = "callToAction")] pub call_to_action: ::serde_json::Value, #[serde(rename = "currentAvailability")] pub current_availability: CurrentAvailability2, #[serde(rename = "encodedSeriesId")] pub encoded_series_id: Option<String>, pub image: Image2, #[serde(rename = "seriesId")] pub series_id: Option<String>, pub text: Text3, #[serde(rename = "textExperienceId")] pub text_experience_id: Option<String>, pub tags: Vec<Tag2>, #[serde(rename = "mediaRights")] pub media_rights: MediaRights2, pub ratings: Vec<Rating2>, pub releases: Vec<Release2>, #[serde(rename = "type")] pub type_field: String, #[serde(rename = "videoArt")] pub video_art: Vec<VideoArt2>, #[serde(rename = "contentType")] pub content_type: Option<String>, #[serde(rename = "episodeNumber")] pub episode_number: Option<::serde_json::Value>, #[serde(rename = "episodeSequenceNumber")] pub episode_sequence_number: Option<::serde_json::Value>, #[serde(rename = "episodeSeriesSequenceNumber")] pub episode_series_sequence_number: Option<::serde_json::Value>, pub family: Option<Family2>, #[serde(default)] pub groups: Vec<Group2>, #[serde(rename = "internalTitle")] pub internal_title: Option<String>, #[serde(rename = "mediaMetadata")] pub media_metadata: Option<MediaMetadata4>, #[serde(rename = "originalLanguage")] pub original_language: Option<String>, #[serde(rename = "programId")] pub program_id: Option<String>, #[serde(rename = "programType")] pub program_type: Option<String>, #[serde(rename = "seasonId")] pub season_id: Option<::serde_json::Value>, #[serde(rename = "seasonSequenceNumber")] pub season_sequence_number: Option<::serde_json::Value>, #[serde(rename = "targetLanguage")] pub target_language: Option<String>, #[serde(rename = "videoId")] pub video_id: Option<String>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct CurrentAvailability2 { pub region: String, #[serde(rename = "kidsMode")] pub kids_mode: Option<bool>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Image2 { pub tile: Tile2, pub title_treatment_layer: TitleTreatmentLayer2, pub title_treatment: TitleTreatment2, pub background: Option<Background2>, pub background_details: Option<BackgroundDetails2>, pub hero_collection: HeroCollection2, pub hero_tile: HeroTile2, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Tile2 { #[serde(rename = "2.29")] pub n229: Option<N2292>, #[serde(rename = "1.78")] pub n178: N1788, #[serde(rename = "0.71")] pub n071: N0712, #[serde(rename = "0.75")] pub n075: Option<N0752>, #[serde(rename = "0.67")] pub n067: Option<N0672>, #[serde(rename = "1.00")] pub n100: Option<N1002>, #[serde(rename = "1.33")] pub n133: Option<N1334>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N2292 { pub program: Option<Program24>, pub series: Option<Series24>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program24 { pub default: Default48, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default48 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series24 { pub default: Default49, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default49 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1788 { pub series: Option<Series25>, pub program: Option<Program25>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series25 { pub default: Default50, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default50 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program25 { pub default: Default51, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default51 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N0712 { pub series: Option<Series26>, pub program: Option<Program26>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series26 { pub default: Default52, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default52 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program26 { pub default: Default53, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default53 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N0752 { pub program: Option<Program27>, pub series: Option<Series27>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program27 { pub default: Default54, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default54 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series27 { pub default: Default55, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default55 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N0672 { pub program: Option<Program28>, pub series: Option<Series28>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program28 { pub default: Default56, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default56 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series28 { pub default: Default57, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default57 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1002 { pub program: Option<Program29>, pub series: Option<Series29>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program29 { pub default: Default58, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default58 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series29 { pub default: Default59, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default59 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1334 { pub program: Option<Program30>, pub series: Option<Series30>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program30 { pub default: Default60, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default60 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series30 { pub default: Default61, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default61 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct TitleTreatmentLayer2 { #[serde(rename = "3.00")] pub n300: N3003, #[serde(rename = "3.91")] pub n391: N3913, #[serde(rename = "1.78")] pub n178: N1789, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N3003 { pub series: Option<Series31>, pub program: Option<Program31>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series31 { pub default: Default62, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default62 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program31 { pub default: Default63, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default63 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N3913 { pub series: Option<Series32>, pub program: Option<Program32>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series32 { pub default: Default64, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default64 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program32 { pub default: Default65, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default65 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1789 { pub series: Option<Series33>, pub program: Option<Program33>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series33 { pub default: Default66, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default66 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program33 { pub default: Default67, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default67 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct TitleTreatment2 { #[serde(rename = "1.78")] pub n178: N17810, #[serde(rename = "3.32")] pub n332: Option<N3322>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N17810 { pub series: Option<Series34>, pub program: Option<Program34>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series34 { pub default: Default68, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default68 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program34 { pub default: Default69, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default69 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N3322 { pub series: Option<Series35>, pub program: Option<Program35>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series35 { pub default: Default70, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default70 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program35 { pub default: Default71, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default71 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Background2 { #[serde(rename = "1.78")] pub n178: N17811, #[serde(rename = "1.33")] pub n133: Option<N1335>, #[serde(rename = "2.89")] pub n289: Option<N2892>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N17811 { pub program: Option<Program36>, pub series: Option<Series36>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program36 { pub default: Default72, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default72 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series36 { pub default: Default73, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default73 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1335 { pub series: Option<Series37>, pub program: Option<Program37>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series37 { pub default: Default74, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default74 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program37 { pub default: Default75, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default75 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N2892 { pub program: Option<Program38>, pub series: Option<Series38>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program38 { pub default: Default76, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default76 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series38 { pub default: Default77, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default77 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct BackgroundDetails2 { #[serde(rename = "1.78")] pub n178: N17812, #[serde(rename = "1.33")] pub n133: N1336, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N17812 { pub program: Option<Program39>, pub series: Option<Series39>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program39 { pub default: Default78, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default78 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series39 { pub default: Default79, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default79 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1336 { pub program: Option<Program40>, pub series: Option<Series40>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program40 { pub default: Default80, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default80 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series40 { pub default: Default81, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default81 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct HeroCollection2 { #[serde(rename = "1.78")] pub n178: N17813, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N17813 { pub series: Option<Series41>, pub program: Option<Program41>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series41 { pub default: Default82, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default82 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program41 { pub default: Default83, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default83 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct HeroTile2 { #[serde(rename = "3.00")] pub n300: N3004, #[serde(rename = "1.78")] pub n178: N17814, #[serde(rename = "3.91")] pub n391: N3914, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N3004 { pub series: Option<Series42>, pub program: Option<Program42>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series42 { pub default: Default84, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default84 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program42 { pub default: Default85, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default85 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N17814 { pub series: Option<Series43>, pub program: Option<Program43>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series43 { pub default: Default86, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default86 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program43 { pub default: Default87, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default87 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N3914 { pub series: Option<Series44>, pub program: Option<Program44>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series44 { pub default: Default88, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default88 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program44 { pub default: Default89, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default89 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterWidth")] pub master_width: i64, #[serde(rename = "masterHeight")] pub master_height: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Text3 { pub title: Title3, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Title3 { pub slug: Slug2, pub full: Full3, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Slug2 { pub series: Option<Series45>, pub program: Option<Program45>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series45 { pub default: Default90, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default90 { pub content: String, pub language: String, #[serde(rename = "sourceEntity")] pub source_entity: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program45 { pub default: Default91, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default91 { pub content: String, pub language: String, #[serde(rename = "sourceEntity")] pub source_entity: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Full3 { pub series: Option<Series46>, pub program: Option<Program46>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series46 { pub default: Default92, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default92 { pub content: String, pub language: String, #[serde(rename = "sourceEntity")] pub source_entity: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program46 { pub default: Default93, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default93 { pub content: String, pub language: String, #[serde(rename = "sourceEntity")] pub source_entity: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Tag2 { #[serde(rename = "displayName")] pub display_name: ::serde_json::Value, #[serde(rename = "type")] pub type_field: String, pub value: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct MediaRights2 { #[serde(rename = "downloadBlocked")] pub download_blocked: bool, #[serde(rename = "pconBlocked")] pub pcon_blocked: bool, #[serde(default)] pub violations: Vec<::serde_json::Value>, pub rewind: Option<bool>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Rating2 { pub advisories: Vec<::serde_json::Value>, pub description: Option<String>, pub system: String, pub value: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Release2 { #[serde(rename = "releaseDate")] pub release_date: Option<String>, #[serde(rename = "releaseType")] pub release_type: String, #[serde(rename = "releaseYear")] pub release_year: i64, pub territory: ::serde_json::Value, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct VideoArt2 { #[serde(rename = "mediaMetadata")] pub media_metadata: MediaMetadata3, pub purpose: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct MediaMetadata3 { pub urls: Vec<Url2>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Url2 { pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Family2 { #[serde(rename = "encodedFamilyId")] pub encoded_family_id: String, #[serde(rename = "familyId")] pub family_id: String, pub parent: bool, #[serde(rename = "parentRef")] pub parent_ref: ParentRef2, #[serde(rename = "sequenceNumber")] pub sequence_number: ::serde_json::Value, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct ParentRef2 { #[serde(rename = "encodedSeriesId")] pub encoded_series_id: ::serde_json::Value, #[serde(rename = "programId")] pub program_id: String, #[serde(rename = "seasonId")] pub season_id: Option<::serde_json::Value>, #[serde(rename = "seriesId")] pub series_id: Option<::serde_json::Value>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Group2 { pub name: String, #[serde(rename = "partnerGroupId")] pub partner_group_id: String, #[serde(rename = "type")] pub type_field: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct MediaMetadata4 { pub format: String, #[serde(rename = "mediaId")] pub media_id: String, pub phase: String, #[serde(rename = "playbackUrls")] pub playback_urls: Vec<PlaybackUrl2>, #[serde(rename = "productType")] pub product_type: String, #[serde(rename = "runtimeMillis")] pub runtime_millis: i64, pub state: String, #[serde(rename = "type")] pub type_field: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct PlaybackUrl2 { pub rel: String, pub href: String, pub templated: bool, pub params: Vec<Param2>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Param2 { pub name: String, pub description: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Meta2 { pub hits: i64, pub offset: i64, pub page_size: i64, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Text4 { pub title: Title4, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Title4 { pub full: Full4, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Full4 { pub set: Set2, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Set2 { pub default: Default94, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default94 { pub content: String, pub language: String, #[serde(rename = "sourceEntity")] pub source_entity: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct PersonalizedCuratedSet { #[serde(rename = "setId")] pub set_id: String, #[serde(rename = "type")] pub type_field: String, #[serde(rename = "contentClass")] pub content_class: String, pub items: Vec<Item3>, pub meta: Meta3, #[serde(rename = "experimentToken")] pub experiment_token: String, pub text: Text6, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Item3 { #[serde(rename = "contentId")] pub content_id: String, #[serde(rename = "currentAvailability")] pub current_availability: CurrentAvailability3, #[serde(rename = "encodedSeriesId")] pub encoded_series_id: Option<String>, pub image: Image3, pub ratings: Vec<Rating3>, pub releases: Vec<Release3>, #[serde(rename = "seriesId")] pub series_id: Option<String>, pub tags: Vec<Tag3>, #[serde(rename = "textExperienceId")] pub text_experience_id: Option<String>, pub text: Text5, #[serde(rename = "type")] pub type_field: String, #[serde(rename = "videoArt")] pub video_art: Vec<VideoArt3>, #[serde(rename = "contentType")] pub content_type: Option<String>, #[serde(rename = "episodeNumber")] pub episode_number: Option<::serde_json::Value>, #[serde(rename = "episodeSequenceNumber")] pub episode_sequence_number: Option<::serde_json::Value>, #[serde(rename = "episodeSeriesSequenceNumber")] pub episode_series_sequence_number: Option<::serde_json::Value>, pub family: Option<Family3>, #[serde(default)] pub groups: Vec<Group3>, #[serde(rename = "internalTitle")] pub internal_title: Option<String>, #[serde(rename = "mediaMetadata")] pub media_metadata: Option<MediaMetadata6>, #[serde(rename = "originalLanguage")] pub original_language: Option<String>, #[serde(rename = "programId")] pub program_id: Option<String>, #[serde(rename = "programType")] pub program_type: Option<String>, #[serde(rename = "seasonId")] pub season_id: Option<::serde_json::Value>, #[serde(rename = "seasonSequenceNumber")] pub season_sequence_number: Option<::serde_json::Value>, #[serde(rename = "videoId")] pub video_id: Option<String>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct CurrentAvailability3 { pub region: String, #[serde(rename = "kidsMode")] pub kids_mode: bool, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Image3 { pub tile: Tile3, pub title_treatment_layer: TitleTreatmentLayer3, pub hero_tile: HeroTile3, pub title_treatment: TitleTreatment3, pub hero_collection: HeroCollection3, pub background: Background3, pub background_details: Option<BackgroundDetails3>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Tile3 { #[serde(rename = "1.33")] pub n133: N1337, #[serde(rename = "1.0")] pub n10: Option<N10>, #[serde(rename = "0.71")] pub n071: N0713, #[serde(rename = "1.78")] pub n178: N17815, #[serde(rename = "2.29")] pub n229: Option<N2293>, #[serde(rename = "0.67")] pub n067: N0673, #[serde(rename = "0.75")] pub n075: N0753, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1337 { pub series: Option<Series47>, pub program: Option<Program47>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series47 { pub default: Default95, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default95 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program47 { pub default: Default96, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default96 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N10 { pub series: Series48, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series48 { pub default: Default97, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default97 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N0713 { pub series: Option<Series49>, pub program: Option<Program48>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series49 { pub default: Default98, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default98 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program48 { pub default: Default99, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default99 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N17815 { pub series: Option<Series50>, pub program: Option<Program49>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series50 { pub default: Default100, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default100 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program49 { pub default: Default101, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default101 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N2293 { pub program: Option<Program50>, pub series: Option<Series51>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program50 { pub default: Default102, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default102 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series51 { pub default: Default103, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default103 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N0673 { pub series: Option<Series52>, pub program: Option<Program51>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series52 { pub default: Default104, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default104 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program51 { pub default: Default105, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default105 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N0753 { pub series: Option<Series53>, pub program: Option<Program52>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series53 { pub default: Default106, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default106 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program52 { pub default: Default107, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default107 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct TitleTreatmentLayer3 { #[serde(rename = "3.0")] pub n30: N30, #[serde(rename = "1.78")] pub n178: N17816, #[serde(rename = "3.91")] pub n391: N3915, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N30 { pub series: Option<Series54>, pub program: Option<Program53>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series54 { pub default: Default108, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default108 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program53 { pub default: Default109, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default109 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N17816 { pub series: Option<Series55>, pub program: Option<Program54>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series55 { pub default: Default110, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default110 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program54 { pub default: Default111, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default111 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N3915 { pub series: Option<Series56>, pub program: Option<Program55>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series56 { pub default: Default112, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default112 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program55 { pub default: Default113, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default113 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct HeroTile3 { #[serde(rename = "3.0")] pub n30: N302, #[serde(rename = "1.78")] pub n178: N17817, #[serde(rename = "3.91")] pub n391: N3916, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N302 { pub series: Option<Series57>, pub program: Option<Program56>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series57 { pub default: Default114, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default114 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program56 { pub default: Default115, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default115 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N17817 { pub series: Option<Series58>, pub program: Option<Program57>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series58 { pub default: Default116, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default116 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program57 { pub default: Default117, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default117 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N3916 { pub series: Option<Series59>, pub program: Option<Program58>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series59 { pub default: Default118, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default118 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program58 { pub default: Default119, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default119 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct TitleTreatment3 { #[serde(rename = "1.78")] pub n178: N17818, #[serde(rename = "3.32")] pub n332: N3323, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N17818 { pub series: Option<Series60>, pub program: Option<Program59>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series60 { pub default: Default120, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default120 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program59 { pub default: Default121, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default121 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N3323 { pub series: Option<Series61>, pub program: Option<Program60>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series61 { pub default: Default122, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default122 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program60 { pub default: Default123, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default123 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct HeroCollection3 { #[serde(rename = "1.78")] pub n178: N17819, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N17819 { pub series: Option<Series62>, pub program: Option<Program61>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series62 { pub default: Default124, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default124 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program61 { pub default: Default125, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default125 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Background3 { #[serde(rename = "2.89")] pub n289: Option<N2893>, #[serde(rename = "1.33")] pub n133: Option<N1338>, #[serde(rename = "1.78")] pub n178: N17820, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N2893 { pub program: Option<Program62>, pub series: Option<Series63>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program62 { pub default: Default126, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default126 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series63 { pub default: Default127, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default127 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1338 { pub series: Option<Series64>, pub program: Option<Program63>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series64 { pub default: Default128, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default128 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program63 { pub default: Default129, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default129 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N17820 { pub series: Option<Series65>, pub program: Option<Program64>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series65 { pub default: Default130, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default130 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program64 { pub default: Default131, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default131 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct BackgroundDetails3 { #[serde(rename = "1.78")] pub n178: N17821, #[serde(rename = "1.33")] pub n133: N1339, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N17821 { pub program: Program65, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program65 { pub default: Default132, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default132 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct N1339 { pub program: Program66, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program66 { pub default: Default133, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default133 { #[serde(rename = "masterId")] pub master_id: String, #[serde(rename = "masterHeight")] pub master_height: i64, #[serde(rename = "masterWidth")] pub master_width: i64, pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Rating3 { pub advisories: Vec<::serde_json::Value>, pub description: Option<String>, pub system: String, pub value: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Release3 { #[serde(rename = "releaseDate")] pub release_date: String, #[serde(rename = "releaseType")] pub release_type: String, #[serde(rename = "releaseYear")] pub release_year: i64, pub territory: ::serde_json::Value, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Tag3 { #[serde(rename = "type")] pub type_field: String, pub value: String, pub entity: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Text5 { pub title: Title5, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Title5 { pub full: Full5, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Full5 { pub series: Option<Series66>, pub program: Option<Program67>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Series66 { pub default: Default134, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default134 { pub content: String, pub language: String, #[serde(rename = "sourceEntity")] pub source_entity: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Program67 { pub default: Default135, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default135 { pub content: String, pub language: String, #[serde(rename = "sourceEntity")] pub source_entity: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct VideoArt3 { #[serde(rename = "mediaMetadata")] pub media_metadata: MediaMetadata5, pub purpose: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct MediaMetadata5 { pub urls: Vec<Url3>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Url3 { pub url: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Family3 { #[serde(rename = "encodedFamilyId")] pub encoded_family_id: String, #[serde(rename = "familyId")] pub family_id: String, pub parent: bool, #[serde(rename = "parentRef")] pub parent_ref: ParentRef3, #[serde(rename = "sequenceNumber")] pub sequence_number: ::serde_json::Value, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct ParentRef3 { #[serde(rename = "encodedSeriesId")] pub encoded_series_id: ::serde_json::Value, #[serde(rename = "programId")] pub program_id: String, #[serde(rename = "seasonId")] pub season_id: Option<::serde_json::Value>, #[serde(rename = "seriesId")] pub series_id: Option<::serde_json::Value>, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Group3 { pub name: String, #[serde(rename = "partnerGroupId")] pub partner_group_id: String, #[serde(rename = "type")] pub type_field: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct MediaMetadata6 { pub format: String, #[serde(rename = "mediaId")] pub media_id: String, pub phase: String, #[serde(rename = "playbackUrls")] pub playback_urls: Vec<PlaybackUrl3>, #[serde(rename = "productType")] pub product_type: String, #[serde(rename = "runtimeMillis")] pub runtime_millis: i64, pub state: String, #[serde(rename = "type")] pub type_field: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct PlaybackUrl3 { pub href: String, pub params: Vec<Param3>, pub rel: String, pub templated: bool, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Param3 { pub description: String, pub name: String, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Meta3 { pub hits: i64, pub page_size: i64, pub offset: i64, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Text6 { pub title: Title6, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Title6 { pub full: Full6, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Full6 { pub set: Set3, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Set3 { pub default: Default136, } #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] pub struct Default136 { pub content: String, pub language: String, #[serde(rename = "sourceEntity")] pub source_entity: String, }
//! https://github.com/lumen/otp/tree/lumen/lib/erl_docgen/src use super::*; test_compiles_lumen_otp!(docgen_edoc_xml_cb); test_compiles_lumen_otp!(docgen_otp_specs); test_compiles_lumen_otp!(docgen_xmerl_xml_cb); test_compiles_lumen_otp!(docgen_xml_check); test_compiles_lumen_otp!(docgen_xml_to_chunk); fn includes() -> Vec<&'static str> { let mut includes = super::includes(); includes.push("lib/xmerl/include"); includes } fn relative_directory_path() -> PathBuf { super::relative_directory_path().join("erl_docgen/src") }
use chrono::{DateTime, Utc}; use eyre::{Result, WrapErr}; use serde::{Deserialize, Serialize}; use std::fmt; use std::io::Write; use std::path::{Path, PathBuf}; #[derive(Debug, Serialize, Deserialize)] pub struct Meta { pub name: String, } #[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Hash, Clone, Copy)] pub enum Status { None, Todo, Doing, Done, } impl fmt::Display for Status { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { match self { Status::None => write!(f, "None"), Status::Todo => write!(f, "Todo"), Status::Doing => write!(f, "Doing"), Status::Done => write!(f, "Done"), } } } impl std::str::FromStr for Status { type Err = eyre::Report; fn from_str(s: &str) -> Result<Self, Self::Err> { match s.to_lowercase().as_str() { "todo" => Ok(Status::Todo), "doing" => Ok(Status::Doing), "done" => Ok(Status::Done), other => Err(eyre::eyre!("invalid status {}", other)), } } } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Change { pub from: Status, pub to: Status, pub on: DateTime<Utc>, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Task { pub id: u64, pub status: Status, pub changes: Vec<Change>, pub priority: Option<i64>, } impl Task { pub fn detail(&self) -> Result<TaskDetail> { let contents = std::fs::read_to_string(self.target_path().wrap_err("computing target path")?) .wrap_err("reading task detail")?; let mut parts = contents.splitn(3, "---"); let _ = parts.next().unwrap(); let header: TaskDetailHeader = serde_yaml::from_str(parts.next().unwrap()).wrap_err("parsing task detail")?; let description = parts.next().unwrap(); Ok(TaskDetail { id: header.id, summary: header.summary, tags: header.tags, description: description.to_string(), }) } fn target_path(&self) -> Result<PathBuf> { let pm_dir = find_project_root() .map(|r| r.join("pm")) .wrap_err("computing pm dir")?; Ok(pm_dir.join("tasks").join(format!("{:03}.md", self.id))) } } #[derive(Debug, Serialize, Deserialize)] pub struct Index { pub meta: Meta, pub tasks: Vec<Task>, } #[derive(Debug, Serialize, Deserialize)] struct TaskDetailHeader { id: u64, summary: String, tags: Vec<String>, } #[derive(Debug, Serialize, Deserialize)] pub struct TaskDetail { pub id: u64, pub summary: String, pub description: String, pub tags: Vec<String>, } impl TaskDetail { fn new(task_id: u64, entry: &[String]) -> TaskDetail { let summary_entries = entry .iter() .filter(|w| !(w.starts_with(':') && w.ends_with(':'))) .map(|w| w.as_str()) .collect::<Vec<_>>(); let summary = summary_entries.join(" "); let tags = entry .iter() .filter_map(|e| { if e.starts_with(':') && e.ends_with(':') { Some(e.chars().skip(1).take_while(|c| *c != ':').collect()) } else { None } }) .collect(); TaskDetail { id: task_id, summary, description: "".to_string(), tags, } } fn save(&self) -> Result<()> { let path = self.target_path().wrap_err("finding detail path")?; let header = self.header(); let header = serde_yaml::to_string(&header).wrap_err("serializing task detail")?; let mut f = std::fs::File::create(path).wrap_err("creating file")?; writeln!(&mut f, "{}", header)?; writeln!(&mut f, "---")?; writeln!(&mut f, "{}", self.description.trim())?; Ok(()) } fn header(&self) -> TaskDetailHeader { TaskDetailHeader { id: self.id, summary: self.summary.clone(), tags: self.tags.clone(), } } fn target_path(&self) -> Result<PathBuf> { let pm_dir = find_project_root() .map(|r| r.join("pm")) .wrap_err("computing pm dir")?; let tasks_dir = pm_dir.join("tasks"); std::fs::create_dir_all(&tasks_dir).wrap_err("creating tasks dir")?; let filename = format!("{:03}.md", self.id); Ok(tasks_dir.join(filename)) } } pub enum Priority { Increase, Decrease, } impl Index { pub fn new(name: impl Into<String>) -> Result<Index> { Ok(Index { meta: Meta { name: name.into() }, tasks: Vec::new(), }) } pub fn save(&self, force: bool) -> Result<()> { let path = find_index_path().wrap_err("finding index path")?; if path.is_file() && !force { return Err(crate::error::PmError::IndexExists.into()); } ensure_parent_dir(&path) .wrap_err_with(|| format!("ensuring parent dir for path {:?}", path))?; let body = serde_yaml::to_string(self).wrap_err("serializing index")?; std::fs::write(path, body).wrap_err("writing index")?; Ok(()) } pub fn load() -> Result<Index> { let path = find_index_path().wrap_err("finding index path")?; let contents = std::fs::read_to_string(&path) .wrap_err_with(|| format!("reading config file {:?}", &path))?; let index: Index = serde_yaml::from_str(&contents).wrap_err("parsing index")?; Ok(index) } pub fn create_task(&mut self, entry: &[String]) -> Result<()> { let task = Task { id: self.next_id(), status: Status::Todo, changes: vec![Change { from: Status::None, to: Status::Todo, on: Utc::now(), }], priority: None, }; let detail = TaskDetail::new(task.id, entry); self.tasks.push(task); // TODO(srw): handle the case of one file not saving and rolling back self.save(true).wrap_err("saving")?; detail.save().wrap_err("saving task detail")?; Ok(()) } pub fn get_task(&self, task_id: u64) -> Option<&Task> { for task in &self.tasks { if task.id == task_id { return Some(task); } } None } pub fn move_task(&mut self, task_id: u64, new_status: Status) -> Result<()> { let mut found = false; for task in self.tasks.iter_mut() { if task.id == task_id { found = true; if task.status == new_status { // do not update break; } let change = Change { from: task.status, to: new_status, on: Utc::now(), }; task.changes.push(change); task.status = new_status; break; } } if !found { return Err(eyre::eyre!("could not find task {}", task_id)); } self.save(true).wrap_err("saving")?; Ok(()) } pub fn delete_task(&mut self, task_id: u64) -> Result<()> { let detail_path = self.detail_path(task_id).wrap_err("getting detail path")?; std::fs::remove_file(&detail_path) .wrap_err_with(|| format!("deleting file {:?}", &detail_path))?; if let Some(idx) = self.tasks.iter().position(|t| t.id == task_id) { self.tasks.remove(idx); } self.save(true).wrap_err("saving")?; Ok(()) } pub fn detail_path(&self, task_id: u64) -> Result<PathBuf> { let pm_dir = find_project_root() .map(|r| r.join("pm")) .wrap_err("computing pm dir")?; Ok(pm_dir.join("tasks").join(format!("{:03}.md", task_id))) } pub fn sorted_tasks_with_status(&self, status: Status) -> Option<Vec<Task>> { let mut tasks: Vec<_> = self .tasks .iter() .cloned() .filter(|t| t.status == status) .collect(); if tasks.is_empty() { return None; } tasks.sort_by(|a, b| match (a.priority, b.priority) { (Some(pa), Some(pb)) => pa.cmp(&pb), (Some(_), None) => std::cmp::Ordering::Greater, (None, Some(_)) => std::cmp::Ordering::Less, (None, None) => a.id.cmp(&b.id), }); Some(tasks) } pub fn update_task_priority(&mut self, task_id: u64, priority: Priority) -> Result<()> { match self.tasks.iter_mut().filter(|t| t.id == task_id).next() { Some(task) => match priority { Priority::Increase => task.priority = Some(task.priority.unwrap_or(0) + 1), Priority::Decrease => task.priority = Some(task.priority.unwrap_or(0) - 1), }, None => return Ok(()), } self.save(true).wrap_err("saving")?; Ok(()) } fn next_id(&self) -> u64 { self.tasks.iter().map(|t| t.id).max().unwrap_or(0) + 1 } } fn find_index_path() -> Result<PathBuf> { let project_root = find_project_root().wrap_err("finding project root")?; Ok(project_root.join("pm").join("index.yml")) } fn find_project_root() -> Result<PathBuf> { let mut cwd = std::env::current_dir().wrap_err("getting current dir")?; loop { if cwd == Path::new("/") { return Err(eyre::eyre!("could not find root path for git repository")); } if cwd.join(".git").is_dir() { return Ok(cwd); } cwd = cwd.join("..").canonicalize()?; } } fn ensure_parent_dir(p: &Path) -> Result<()> { // unwrap is safe because we construct the final two path components let parent_dir = p.parent().unwrap(); std::fs::create_dir_all(parent_dir) .wrap_err_with(|| format!("creating directory {:?}", parent_dir))?; Ok(()) } #[cfg(test)] mod tests { use super::*; #[test] fn parse_index() { let text = r#" meta: name: My first project tasks: - id: 1 status: Doing changes: - from: Todo to: Doing on: 2021-01-01T00:00:00+00:00 - id: 2 status: Done changes: - from: Todo to: Doing on: 2021-01-01T00:00:00+00:00 - from: Doing to: Done on: 2021-02-01T00:00:00+00:00 "#; let parsed: Index = serde_yaml::from_str(text).unwrap(); assert_eq!(parsed.meta.name, "My first project"); } #[test] fn parse_entry_for_task_detail_no_tags() { let entry = vec!["A".to_string(), "basic".to_string(), "title".to_string()]; let task_detail = TaskDetail::new(0, &entry); assert_eq!(task_detail.summary, "A basic title".to_string()); assert_eq!(task_detail.tags, Vec::<String>::new()); } #[test] fn parse_entry_for_task_detail_with_tags() { let entry = vec![ "A".to_string(), "basic".to_string(), ":tag:".to_string(), "title".to_string(), ]; let task_detail = TaskDetail::new(0, &entry); assert_eq!(task_detail.summary, "A basic title".to_string()); assert_eq!(task_detail.tags, vec!["tag".to_string()]); } #[test] fn task_sorting_without_priorities() { let tasks = vec![ Task { id: 1, status: Status::Done, changes: vec![], priority: None, }, Task { id: 2, status: Status::Done, changes: vec![], priority: None, }, ]; let index = Index { meta: Meta { name: "Foo".to_string(), }, tasks, }; let retrieved_tasks = index.sorted_tasks_with_status(Status::Done).unwrap(); let ids: Vec<_> = retrieved_tasks.iter().map(|t| t.id).collect(); assert_eq!(ids, &[1, 2]); } #[test] fn task_sorting_with_priorities() { let tasks = vec![ Task { id: 1, status: Status::Done, changes: vec![], priority: Some(100), }, Task { id: 2, status: Status::Done, changes: vec![], priority: None, }, ]; let index = Index { meta: Meta { name: "Foo".to_string(), }, tasks, }; let retrieved_tasks = index.sorted_tasks_with_status(Status::Done).unwrap(); let ids: Vec<_> = retrieved_tasks.iter().map(|t| t.id).collect(); assert_eq!(ids, &[2, 1]); } }
use generated_types::influxdata::iox::partition_template::v1 as proto; use snafu::{ResultExt, Snafu}; #[allow(clippy::enum_variant_names)] #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("Client Error: Invalid partition template format : {source}"))] InvalidPartitionTemplate { source: serde_json::Error }, #[snafu(display("Client Error: Parts cannot be empty"))] NoParts, } #[derive(Debug, clap::Parser, Default, Clone)] pub struct PartitionTemplateConfig { /// Partition template format: /// /// e.g. {"parts": [{"timeFormat": "%Y-%m"}, {"tagValue": "col1"}, {"tagValue": "col2,col3,col4"}]} /// /// - timeFormat and tagValue can be in any order /// /// - The value of timeFormat and tagValue are string and can be whatever at parsing time. /// If they are not in the right format the server expcected, the server will return error. /// Note that "time" is a reserved word and cannot be used in timeFormat. /// /// - The number of timeFormats and tagValues are not limited at parsing time. Server limits /// the total number of them and will send back error if it exceeds the limit 8. #[clap( action, long = "partition-template", short = 'p', default_value = None, value_parser = parse_partition_template, )] pub partition_template: Option<proto::PartitionTemplate>, } fn parse_partition_template(s: &str) -> Result<proto::PartitionTemplate, Error> { let part_template: proto::PartitionTemplate = serde_json::from_str(s).context(InvalidPartitionTemplateSnafu)?; // Error if empty parts if part_template.parts.is_empty() { return Err(Error::NoParts); } Ok(part_template) } #[cfg(test)] mod tests { use clap::Parser; use test_helpers::assert_contains; use crate::commands::partition_template::PartitionTemplateConfig; use generated_types::influxdata::iox::partition_template::v1::template_part::Part; // =================================================== // Negative tests for parsing invalid partition template #[test] fn missing_partition_templat() { let error = PartitionTemplateConfig::try_parse_from(["server", "--partition-template"]) .unwrap_err() .to_string(); assert_contains!(error, "error: a value is required for '--partition-template <PARTITION_TEMPLATE>' but none was supplied" ); } #[test] fn empty_partition_templat_time_format() { let partition_template = PartitionTemplateConfig::try_parse_from(["server", "--partition-template", ""]) .unwrap_err() .to_string(); assert_contains!(partition_template, "Client Error: Invalid partition template format : EOF while parsing a value at line 1 column 0"); } #[test] fn empty_parts() { let partition_template = PartitionTemplateConfig::try_parse_from([ "server", "--partition-template", "{\"parts\": []}", ]) .unwrap_err() .to_string(); assert_contains!(partition_template, "Client Error: Parts cannot be empty"); } #[test] fn wrong_time_format() { let partition_template = PartitionTemplateConfig::try_parse_from([ "server", "--partition-template", "{\"parts\": [{\"time Format\": \"whatever\"}] }", ]) .unwrap_err() .to_string(); assert_contains!(partition_template, "Client Error: Invalid partition template format : unknown field `time Format`, expected one of `tag_value`, `tagValue`, `time_format`, `timeFormat`"); } #[test] fn wrong_tag_format() { let partition_template = PartitionTemplateConfig::try_parse_from([ "server", "--partition-template", "{\"parts\": [{\"wrong format\": \"whatever\"}] }", ]) .unwrap_err() .to_string(); assert_contains!(partition_template, "Client Error: Invalid partition template format : unknown field `wrong format`, expected one of `tag_value`, `tagValue`, `time_format`, `timeFormat`"); } #[test] fn wrong_parts_format() { let partition_template = PartitionTemplateConfig::try_parse_from([ "server", "--partition-template", "{\"prts\": [{\"TagValue\": \"whatever\"}] }", ]) .unwrap_err() .to_string(); assert_contains!(partition_template, "Client Error: Invalid partition template format : unknown field `prts`, expected `parts`"); } // =================================================== // Positive tests for parsing valid partition template #[test] fn valid_time_format() { let actual = PartitionTemplateConfig::try_parse_from([ "server", "--partition-template", "{\"parts\": [{\"timeFormat\": \"whatever\"}] }", ]) .unwrap(); let part_template = actual.partition_template.unwrap(); assert_eq!(part_template.parts.len(), 1); assert_eq!( part_template.parts[0].part, Some(Part::TimeFormat("whatever".to_string())) ); } #[test] fn valid_tag_format() { let actual = PartitionTemplateConfig::try_parse_from([ "server", "--partition-template", "{\"parts\": [{\"tagValue\": \"whatever\"}] }", ]) .unwrap(); let part_template = actual.partition_template.unwrap(); assert_eq!(part_template.parts.len(), 1); assert_eq!( part_template.parts[0].part, Some(Part::TagValue("whatever".to_string())) ); } #[test] fn valid_partition_template_time_first() { let actual = PartitionTemplateConfig::try_parse_from([ "server", "--partition-template", "{\"parts\": [{\"timeFormat\": \"%Y.%j\"}, {\"tagValue\": \"col1\"}, {\"tagValue\": \"col2,col3 col4\"}] }", ]) .unwrap(); let part_template = actual.partition_template.unwrap(); assert_eq!(part_template.parts.len(), 3); assert_eq!( part_template.parts[0].part, Some(Part::TimeFormat("%Y.%j".to_string())) ); assert_eq!( part_template.parts[1].part, Some(Part::TagValue("col1".to_string())) ); assert_eq!( part_template.parts[2].part, Some(Part::TagValue("col2,col3 col4".to_string())) ); } #[test] fn valid_partition_template_time_middle() { let actual = PartitionTemplateConfig::try_parse_from([ "server", "--partition-template", "{\"parts\": [{\"tagValue\": \"col1\"}, {\"timeFormat\": \"%Y.%j\"}, {\"tagValue\": \"col2,col3 col4\"}] }", ]) .unwrap(); let part_template = actual.partition_template.unwrap(); assert_eq!(part_template.parts.len(), 3); assert_eq!( part_template.parts[0].part, Some(Part::TagValue("col1".to_string())) ); assert_eq!( part_template.parts[1].part, Some(Part::TimeFormat("%Y.%j".to_string())) ); assert_eq!( part_template.parts[2].part, Some(Part::TagValue("col2,col3 col4".to_string())) ); } }
pub fn verse(n: u32) -> String { match n { 0 => "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n".into(), 1 => "1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n".into(), _ => { let remaining_bottles = if n > 2 { format!("{} bottles", n - 1) } else /* n == 2 */ { "1 bottle".into() }; format!("{} bottles of beer on the wall, {} bottles of beer.\nTake one down and pass it around, {} of beer on the wall.\n", n, n, remaining_bottles) } } } pub fn sing(start: u32, end: u32) -> String { let verses: Vec<String> = (end..=start).rev().map(verse).collect(); verses.join("\n") }
pub fn quicksort(a: &mut [i32], l: usize, h: usize) { if l < h { let p = partition(a, l, h); quicksort(a, l, p - 1); // left of pivot quicksort(a, p + 1, h); // right of pivot } } fn partition(a: &mut [i32], l: usize, h: usize) -> usize { let index = h; let pivot = a[index]; let mut i = l; for j in l..h { if a[j] < pivot { a.swap(i, j); i += 1; } } a.swap(i, index); i } // Unit Testing #[cfg(test)] mod tests { use super::*; #[test] fn check_order() { let mut start = [9, 1, 2, 8, 10, 10]; let end = [1, 2, 8, 9, 10, 10]; let n = start.len(); quicksort(&mut start, 0, n - 1); assert_eq!(end, start); } }
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. use alloc::sync::Arc; use spin::Mutex; use core::ops::Deref; use super::super::super::threadmgr::task_block::*; use super::super::super::qlib::common::*; use super::entry::*; use super::queue::*; use super::*; #[derive(Default)] pub struct QLockInternal { pub queue: Queue, pub locked: bool, } #[derive(Default, Clone)] pub struct QLock(Arc<Mutex<QLockInternal>>); impl Deref for QLock { type Target = Arc<Mutex<QLockInternal>>; fn deref(&self) -> &Arc<Mutex<QLockInternal>> { &self.0 } } impl QLock { //if return == true, it is blocked, otherwise it can return pub fn EventRegister(&self, task: &Task, e: &WaitEntry, mask: EventMask) -> bool { let mut l = self.lock(); if l.locked == false { //fast path, got lock l.locked = true; return false; } e.Clear(); l.queue.EventRegister(task, e, mask); return true; } pub fn Unlock(&self) { let mut l = self.lock(); assert!(l.locked == true, "QLock::Unlock misrun"); l.locked = false; l.queue.Notify(!0); l.queue.write().RemoveAll(); } pub fn Lock(&self, task: &Task) -> Result<QLockGuard> { let blocker = task.blocker.clone(); loop { let block = self.EventRegister(task, &blocker.generalEntry, 1); info!("Qlock block is {}", block); if !block { //fast path return Ok(QLockGuard { lock: Some(self.clone()), }) } match blocker.BlockGeneral() { Err(e) => { self.lock().queue.EventUnregister(task, &blocker.generalEntry); return Err(e) } Ok(()) => () } self.lock().queue.EventUnregister(task, &blocker.generalEntry); } //return blocker.Qlock(task, self); } } impl Blocker { pub fn Qlock(&self, task: &Task, l: &QLock) -> Result<QLockGuard> { loop { let block = l.EventRegister(task, &self.generalEntry, 1); if !block { //fast path return Ok(QLockGuard { lock: Some(l.clone()), }) } match self.BlockGeneral() { Err(e) => { l.lock().queue.EventUnregister(task, &self.generalEntry); return Err(e) } Ok(()) => () } } } } #[derive(Clone, Default)] pub struct QLockGuard { pub lock: Option<QLock> } impl Drop for QLockGuard { fn drop(&mut self) { let lock = self.lock.take(); if lock.is_some() { lock.unwrap().Unlock(); } } }
extern crate time; extern crate postgres; use postgres::{PostgresConnection, NoSsl}; use time::Timespec; struct SensorPacket { id: i32, value: f64, name: String, time_created: time::Timespec } fn main() { let conn = PostgresConnection::connect("postgres://root:alphabeta@127.0.0.1:5432/local",&NoSsl).unwrap(); let query = "SELECT * FROM tmp_table"; let stmt = conn.prepare(query).unwrap(); for row in stmt.query([]).unwrap() { let packet = SensorPacket { id: row.get("id"), name: row.get("name"), time_created: row.get("time_created"), value: row.get("value") }; println!("Found sensor {}, {}, {}, {}", packet.id, packet.name, packet.time_created, packet.value); } }
#[allow(unused_imports)] use proconio::{marker::*, *}; #[fastout] fn main() { input! { n: i32, } let mut s = "0".repeat(10); for i in 0..10 { let d = 1 << i; s.replace_range((10-i-1)..(10-i), if n / d % 2 == 0 { "0" } else { "1" }); } println!("{}", s); }
use std::sync::Arc; use std::time::Instant; use crate::raw_event::RawEvent; use crate::serialization::SerializationSink; use crate::StringId; pub struct Profiler<S: SerializationSink> { event_sink: Arc<S>, start_time: Instant, } impl<S: SerializationSink> Profiler<S> { pub fn new(event_sink: Arc<S>) -> Self { Self { event_sink, start_time: Instant::now(), } } /// Creates a "start" event and returns a `TimingGuard` that will create /// the corresponding "end" event when it is dropped. #[inline] pub fn start_recording_interval_event<'a>( &'a self, event_kind: StringId, event_id: StringId, thread_id: u32, ) -> TimingGuard<'a, S> { TimingGuard { profiler: self, event_id, event_kind, thread_id, start_ns: self.nanos_since_start(), } } fn record_raw_event(&self, raw_event: &RawEvent) { self.event_sink .write_atomic(std::mem::size_of::<RawEvent>(), |bytes| { raw_event.serialize(bytes); }); } fn nanos_since_start(&self) -> u64 { let duration_since_start = self.start_time.elapsed(); duration_since_start.as_secs() * 1_000_000_000 + duration_since_start.subsec_nanos() as u64 } } /// When dropped, this `TimingGuard` will record an "end" event in the /// `Profiler` it was created by. #[must_use] pub struct TimingGuard<'a, S: SerializationSink> { profiler: &'a Profiler<S>, event_id: StringId, event_kind: StringId, thread_id: u32, start_ns: u64, } impl<'a, S: SerializationSink> Drop for TimingGuard<'a, S> { #[inline] fn drop(&mut self) { let raw_event = RawEvent::new_interval( self.event_kind, self.event_id, self.thread_id, self.start_ns, self.profiler.nanos_since_start(), ); self.profiler.record_raw_event(&raw_event); } }
#![allow(bad_style)] #[macro_use] extern crate pest_derive; extern crate pest; mod parser { #[derive(Parser)] #[grammar = "../examples/calc.pest"] pub struct Parser; } use pest::{ Parser, iterators::Pairs, pratt_parser::{ PrattParser, Assoc::*, Op, }, }; use std::io::{stdin, stdout, Write, BufRead}; use parser::Rule; fn interpret_str(pairs: Pairs<Rule>, pratt: &PrattParser<Rule>) -> String { pratt .map_primary(|primary| match primary.as_rule() { Rule::int => primary.as_str().to_owned(), Rule::expr => interpret_str(primary.into_inner(), pratt), _ => unreachable!(), }) .map_prefix(|op, rhs| match op.as_rule() { Rule::neg => format!("(-{})", rhs), _ => unreachable!(), }) .map_postfix(|lhs, op| match op.as_rule() { Rule::fac => format!("({}!)", lhs), _ => unreachable!(), }) .map_infix(|lhs, op, rhs| match op.as_rule() { Rule::add => format!("({}+{})", lhs, rhs), Rule::sub => format!("({}-{})", lhs, rhs), Rule::mul => format!("({}*{})", lhs, rhs), Rule::div => format!("({}/{})", lhs, rhs), Rule::pow => format!("({}^{})", lhs, rhs), _ => unreachable!(), }) .parse(pairs) .unwrap() } fn interpret_i32(pairs: Pairs<Rule>, pratt: &PrattParser<Rule>) -> i128 { pratt .map_primary(|primary| match primary.as_rule() { Rule::int => primary.as_str().parse().unwrap(), Rule::expr => interpret_i32(primary.into_inner(), pratt), _ => unreachable!(), }) .map_prefix(|op, rhs| match op.as_rule() { Rule::neg => -rhs, _ => unreachable!(), }) .map_postfix(|lhs, op| match op.as_rule() { Rule::fac => (1..lhs+1).product(), _ => unreachable!(), }) .map_infix(|lhs, op, rhs| match op.as_rule() { Rule::add => lhs + rhs, Rule::sub => lhs - rhs, Rule::mul => lhs * rhs, Rule::div => lhs / rhs, Rule::pow => (1..rhs+1).map(|_| lhs).product(), _ => unreachable!(), }) .parse(pairs) .unwrap() } fn main() { let pratt = PrattParser::new() .op(Op::infix(Rule::add, Left) | Op::infix(Rule::sub, Left)) .op(Op::infix(Rule::mul, Left) | Op::infix(Rule::div, Left)) .op(Op::infix(Rule::pow, Right)) .op(Op::postfix(Rule::fac)) .op(Op::prefix(Rule::neg)); let stdin = stdin(); let mut stdout = stdout(); loop { let source = { print!("> "); let _ = stdout.flush(); let mut input = String::new(); let _ = stdin.read_line(&mut input); input.trim().to_string() }; let pairs = match parser::Parser::parse(Rule::program, &source) { Ok(mut parse_tree) => { parse_tree .next().unwrap().into_inner() // inner of program .next().unwrap().into_inner() // inner of expr }, Err(err) => { println!("Failed parsing input: {:}", err); continue; } }; print!("{} => ", source); print!("{} => ", interpret_i32(pairs.clone(), &pratt)); println!("{}", interpret_str(pairs.clone(), &pratt)); } }
mod network { #[derive(Clone)] pub struct PipeWrap { pipe_fd: Vec<usize>, } impl PipeWrap { fn new() -> Self { let mut fd: Vec<usize> = vec![]; fd.push(usize::MAX); fd.push(usize::MAX); Self { pipe_fd: fd, } } } pub trait PipeWrapTrait { fn write(buf: *const (), n: usize) -> usize; fn read(buf: *mut (), n: usize) -> usize; fn readfd(&self) -> usize; fn writefd(&self) -> usize; fn clearfd(&self); } /* impl PipeWrapTrait for PipeWrap { fn write(buf: *const (), n: usize) -> usize { } fn read(buf: *mut (), n: usize) -> usize { } fn readfd(&self) -> usize { return self.pipe_fd[0].clone(); } fn writefd(&self) -> usize { return self.pipe_fd[1].clone(); } } */ }
use std::ffi::CString; use std::os::raw::c_char; static MSG: &'static str = "[mozMeetup] hello from rust"; #[no_mangle] pub fn hello() -> *mut c_char { let s = CString::new(MSG).unwrap(); s.into_raw() } #[no_mangle] pub fn get_len() -> usize { MSG.len() } fn main() { // blank intentionally }
mod with_tuples_in_init_list; use super::*; #[test] fn without_tuple_in_init_list_errors_badarg() { run!( |arc_process| { ( Just(arc_process.clone()), (0_usize..255_usize), strategy::term(arc_process.clone()), strategy::term::is_not_tuple(arc_process.clone()), ) }, |(arc_process, arity_usize, default_value, element)| { let arity = arc_process.integer(arity_usize); let init_list = arc_process.list_from_slice(&[element]); prop_assert_badarg!( result(&arc_process, arity, default_value, init_list), format!( "init list ({}) element ({}) is not {{position :: pos_integer(), term()}}", init_list, element ) ); Ok(()) }, ); }
use std::collections::HashSet; const INPUT: &str = include_str!("./input"); fn parse_anyone_yes(input: &str) -> usize { input .trim_end() .split("\n\n") .map(|group| { group .lines() .flat_map(|s| s.chars()) .collect::<HashSet<_>>() .len() }) .sum() } fn parse_everyone_yes(input: &str) -> usize { input .trim_end() .split("\n\n") .map(|group| { group .lines() .map(|line| line.chars().collect::<HashSet<_>>()) .fold(('a'..='z').collect::<HashSet<_>>(), |acc, b| { acc.intersection(&b).cloned().collect() }) .len() }) .sum() } fn part_1() -> usize { parse_anyone_yes(INPUT) } fn part_2() -> usize { parse_everyone_yes(INPUT) } #[test] fn test_parse_anyone_yes() { assert_eq!( parse_anyone_yes( r#"abc a b c ab ac a a a a b "# ), 11 ); } #[test] fn test_part_1() { assert_eq!(part_1(), 6521); } #[test] fn test_parse_everyone_yes() { assert_eq!( parse_everyone_yes( r#"abc a b c ab ac a a a a b "# ), 6 ); } #[test] fn test_part_2() { assert_eq!(part_2(), 3305); }
use crate::{ grammar::ty_path, grammar::{ty_name, Parser}, parser::Marker, SyntaxKind::*, T, }; use super::{method_decl, method_sig}; pub(crate) fn trait_decl(p: &mut Parser, m: Marker) { p.bump(T![trait]); ty_path(p); p.expect(T![=]); trait_expr(p); m.complete(p, TRAIT_DECL); } pub(crate) fn trait_expr(p: &mut Parser) { let m = p.start(); basic_trait_expr(p); while !p.at(T![;]) && !p.at(EOF) { trait_op(p); } m.complete(p, TRAIT_EXPR); } pub(crate) fn basic_trait_expr(p: &mut Parser) { if p.at(T!['{']) { trait_method_set(p) } else { if p.at(CAP_IDENT) && !p.nth_at(1, T![<]) && !p.at(T![lower_ident]) { trait_name(p); } else { trait_method(p); } } } fn trait_method_set(p: &mut Parser) { let m = p.start(); p.bump(T!['{']); while !p.at(EOF) && !p.at(T!['}']) { method_decl(p); } p.expect(T!['}']); m.complete(p, TRAIT_METHOD_SET); } fn trait_method(p: &mut Parser) { let m = p.start(); method_decl(p); m.complete(p, TRAIT_METHOD); } fn trait_name(p: &mut Parser) { let m = p.start(); ty_name(p); m.complete(p, TRAIT_NAME); } pub(crate) fn trait_op(p: &mut Parser) { match p.current() { T![removes] => { if p.nth_at(1, T!['{']) { trait_remove_set(p); } else { trait_remove_sig(p); } } T![adds] => trait_add(p), T![modifies] => trait_modifies(p), _ => p.error("expected trait operation"), } } fn trait_remove_sig(p: &mut Parser) { let m = p.start(); p.bump(T![removes]); while p.at(T!['[']) || p.at(CAP_IDENT) { method_sig(p); } m.complete(p, TRAIT_REMOVE_SIG); } fn trait_remove_set(p: &mut Parser) { let m = p.start(); p.bump(T![removes]); p.bump(T!['{']); while !p.at(EOF) && !p.at(T!['}']) { method_sig(p); } m.complete(p, TRAIT_REMOVE_SET); } fn trait_add(p: &mut Parser) { let m = p.start(); p.bump(T![adds]); basic_trait_expr(p); m.complete(p, TRAIT_ADD); } fn trait_modifies(p: &mut Parser) { let m = p.start(); p.bump(T![modifies]); basic_trait_expr(p); m.complete(p, TRAIT_MODIFIES); } pub(crate) fn trait_use(p: &mut Parser) { let m = p.start(); p.bump(T![uses]); trait_expr(p); p.expect(T![;]); m.complete(p, TRAIT_USE); }
use std::convert::{TryFrom, TryInto}; use anyhow::*; use liblumen_alloc::erts::term::prelude::*; use crate::runtime::proplist::*; pub struct Options { pub positive: bool, pub monotonic: bool, } impl Default for Options { fn default() -> Self { Self { monotonic: false, positive: false, } } } const SUPPORTED_OPTION_CONTEXT: &str = "supported options are monotonic or positive"; impl Options { fn put_option_term(&mut self, option: Term) -> Result<&Self, anyhow::Error> { let atom: Atom = option.try_into().context(SUPPORTED_OPTION_CONTEXT)?; match atom.name() { "monotonic" => { self.monotonic = true; Ok(self) } "positive" => { self.positive = true; Ok(self) } name => Err(TryPropListFromTermError::AtomName(name)).context(SUPPORTED_OPTION_CONTEXT), } } } impl TryFrom<Term> for Options { type Error = anyhow::Error; fn try_from(term: Term) -> Result<Self, Self::Error> { let mut options: Options = Default::default(); let mut options_term = term; loop { match options_term.decode().unwrap() { TypedTerm::Nil => return Ok(options), TypedTerm::List(cons) => { options.put_option_term(cons.head)?; options_term = cons.tail; continue; } _ => return Err(ImproperListError.into()), } } } }
//! Representations of errors returned by this crate. use ssmarshal; #[cfg(feature = "use_std")] use std::io; #[cfg(feature = "use_std")] use std::result; #[cfg(not(feature = "use_std"))] use core::result; /// Type alias for results from this crate. pub type Result<T> = result::Result<T, Error>; /// Errors from this crate. #[derive(Debug)] pub enum Error { /// COBS decode failed CobsDecodeFailed, /// COBS encode failed CobsEncodeFailed, /// Checksum error: the received frame was corrupted. ChecksumError, /// End of data while reading a frame; we received some of a frame /// but it was incomplete. EofDuringFrame, /// End of data before a frame started; we received none of a frame. EofBeforeFrame, /// Forwarded io::Error. #[cfg(feature = "use_std")] Io(io::Error), /// Forwarded ssmarshal::Error. Ssmarshal(ssmarshal::Error), } impl Error { /// Returns true if the error represents a corrupted frame. Data /// may have been lost but the decoder should decode the next /// frame correctly. pub fn is_corrupt_frame(&self) -> bool { match *self { Error::ChecksumError | Error::CobsDecodeFailed | Error::EofDuringFrame => true, _ => false, } } } #[cfg(feature = "use_std")] impl From<io::Error> for Error { fn from(e: io::Error) -> Error { Error::Io(e) } } impl From<ssmarshal::Error> for Error { fn from(e: ssmarshal::Error) -> Error { Error::Ssmarshal(e) } }
#[test] fn teest_const() { const N: i32 = 5; } #[test] fn test_static() { static N: i32 = 5; static NAME: &'static str = "Steve"; } #[test] fn test_mutable_static() { static mut N: i32 = 5; // mutating static variables is unsafe unsafe { N += 1; println!("N: {}", N); } }
fn main() { let x = String::from("hello"); let y = x; println!("{}", x) // error: x does not own a resource }
/// A color struct #[derive(Copy, Clone, Debug)] pub struct Color { pub r: u8, pub g: u8, pub b: u8, } impl Color { /// Get the manhattan distance between two colors pub fn dist(&self, color: &Color) -> u16 { ((color.r as i16 - self.r as i16).abs() + (color.g as i16 - self.g as i16).abs() + (color.b as i16 - self.b as i16).abs()) as u16 } }
//! Container for resources, that can be any type. This is inspired by Shred and AnyMap. //! AnyMap didn't fill my usecase as there is no way to borrow mutably 2 values for different //! keys. (`get_mut(&mut self)`). //! //! This container is using interior mutability with `RefCell` to allow this usecase. //! Downcasting trait does not work with pure rust so I am using a crate called `downcast_rs` to //! do it. //! //! //! How to user. //! ``` //! use spacegame::resources::Resources; //! let mut resources = Resources::new(); //! resources.insert(String::from("Bonjour")); //! resources.insert(0u8); //! //! // Modify a value. //! { //! let mut my_u8 = resources.fetch_mut::<u8>().unwrap(); //! *my_u8 += 1; //! } //! //! // Read a value and modify another value in the same scope. //! { //! let my_u8 = resources.fetch::<u8>().unwrap(); //! let mut my_string = resources.fetch_mut::<String>().unwrap(); //! my_string.push_str("hhh"); //! println!("{}", *my_u8); //! } //! //! ``` use downcast_rs::{impl_downcast, Downcast}; use std::any::{Any, TypeId}; use std::cell::{Ref, RefCell, RefMut}; use std::collections::HashMap; use std::convert::AsRef; use std::marker::PhantomData; use std::ops::{Deref, DerefMut}; pub trait Resource: Any + 'static + Downcast {} impl_downcast!(Resource); impl<T> Resource for T where T: Any + 'static {} pub struct Fetch<'a, T: 'static> { inner: Ref<'a, dyn Resource>, phantom: PhantomData<&'a T>, } impl<'a, T: 'static> Deref for Fetch<'a, T> { type Target = T; fn deref(&self) -> &Self::Target { self.inner.downcast_ref::<T>().unwrap() } } pub struct FetchMut<'a, T: 'static> { inner: RefMut<'a, dyn Resource>, phantom: PhantomData<&'a T>, } impl<'a, T: 'static> Deref for FetchMut<'a, T> { type Target = T; fn deref(&self) -> &Self::Target { self.inner.downcast_ref::<T>().unwrap() } } impl<'a, T: 'static> DerefMut for FetchMut<'a, T> { fn deref_mut(&mut self) -> &mut Self::Target { self.inner.downcast_mut::<T>().unwrap() } } #[derive(Default)] pub struct Resources { inner: HashMap<TypeId, RefCell<Box<dyn Resource>>>, } impl Resources { pub fn new() -> Self { Self { inner: HashMap::new(), } } /// Insert a new value for the type. It will replace the existing value /// if it exists. pub fn insert<T: Any>(&mut self, v: T) { self.inner .insert(TypeId::of::<T>(), RefCell::new(Box::new(v))); } /// Borrow data immutably from the map. Can panic if already borrowed mutably. pub fn fetch<T: Any + 'static>(&self) -> Option<Fetch<T>> { let cloned = { let ty = TypeId::of::<T>(); match self.inner.get(&ty) { Some(v) => v, None => return None, } }; let borrowed: Ref<Box<dyn Resource>> = cloned.borrow(); Some(Fetch { inner: Ref::map(borrowed, Box::as_ref), phantom: PhantomData, }) } /// Borrow data mutably from the map. Can panic if already borrowed pub fn fetch_mut<T: Any + 'static>(&self) -> Option<FetchMut<T>> { let cloned = { let ty = TypeId::of::<T>(); match self.inner.get(&ty) { Some(v) => v, None => return None, } }; // this panics if already borrowed. let borrowed = cloned.borrow_mut(); Some(FetchMut { inner: RefMut::map(borrowed, Box::as_mut), phantom: PhantomData, }) } }
use super::day::{Day}; use itertools::Itertools; pub struct Day01 {} impl Day for Day01 { fn day_number(&self) -> &str { "01" } fn part_1(&self) -> String { let input: Vec<i32> = self.load_input() .lines() .filter_map(|n| n.parse::<i32>().ok()) .collect(); let mut sum: i32 = 0; let mut last_x = input[0]; for x in input { if x > last_x { sum += 1; } last_x = x; } sum.to_string() } fn part_2(&self) -> String { let input: Vec<i32> = self.load_input() .lines() .filter_map(|n| n.parse::<i32>().ok()) .collect(); let sum = input.into_iter() .tuple_windows::<(_, _, _)>() .tuple_windows() .filter(|((a1, a2, a3), (b1, b2, b3))| (b1 + b2 + b3) > (a1 + a2 + a3)) .count(); sum.to_string() } }
pub struct Ball { pub x: i32, pub y: i32, x_dir: i8, y_dir: i8, } impl Ball { pub fn new(x_start: u32, y_start:u32) -> Ball { Ball { x: x_start as i32, x_dir: 1, y: y_start as i32, y_dir: 1, } } pub fn update(&mut self, width_start: u32, width_end: u32, height_start: u32, height_end: u32) { if self.x < width_start as i32 { self.x_dir = 1; } else if self.x > width_end as i32 { self.x_dir = -1; } self.x += self.x_dir as i32; if self.y < height_start as i32 { self.y_dir = 1; } else if self.y > height_end as i32 { self.y_dir = -1; } self.y += self.y_dir as i32; } }
use super::*; #[derive(Debug)] pub struct Block { pub index: usize, pub timestamp: u128, pub hash: BlockHash, pub prev_block_hash: BlockHash, pub nonce: u64, pub payload: String, pub difficulty: u128, } impl Block { pub fn new( index: usize, timestamp: u128, prev_block_hash: BlockHash, nonce: u64, payload: String, difficulty: u128, ) -> Self { Block { index, timestamp, hash: vec![0; 32], prev_block_hash, nonce, payload, difficulty, } } pub fn mine(&mut self) { for nonce_attempt in 0..u64::max_value() { self.nonce = nonce_attempt; let hash = self.hash(); if check_difficulty(&hash, self.difficulty) { self.hash = hash; return; } } } } impl Hashable for Block { fn bytes(&self) -> Vec<u8> { let mut bytes = vec![]; bytes.extend(&self.index.to_le_bytes()); bytes.extend(&self.timestamp.to_le_bytes()); bytes.extend(&self.prev_block_hash); bytes.extend(&self.nonce.to_le_bytes()); bytes.extend(self.payload.as_bytes()); bytes.extend(&self.difficulty.to_le_bytes()); bytes } } pub fn check_difficulty(hash: &BlockHash, difficulty: u128) -> bool { difficulty > difficulty_bytes_as_u128(&hash) } #[cfg(test)] mod tests { use super::*; #[test] fn test_block_1() { let block = Block::new( 0, 0, vec![0; 32], 0, "Genesis block!".to_owned(), 0x0000_ffff_ffff_ffff_ffff_ffff_ffff_ffff, ); assert_eq!(block.index, 0); assert_eq!(block.timestamp, 0); assert_eq!(block.hash, vec![0; 32]); assert_eq!(block.prev_block_hash, vec![0; 32]); assert_eq!(block.nonce, 0); assert_eq!(block.payload, "Genesis block!".to_owned()); assert_eq!(block.difficulty, 0x0000_ffff_ffff_ffff_ffff_ffff_ffff_ffff); } #[test] fn test_bytes_1() { let block = Block::new( 0, 0, vec![0; 32], 0, "Genesis block!".to_owned(), 0x0000_ffff_ffff_ffff_ffff_ffff_ffff_ffff, ); assert_eq!(block.bytes(), block.bytes()); } #[test] fn test_hash_1() { let block = Block::new( 0, 0, vec![0; 32], 0, "Genesis block!".to_owned(), 0x0000_ffff_ffff_ffff_ffff_ffff_ffff_ffff, ); assert_eq!(block.hash(), block.hash()); } #[test] fn test_hash_2() { let block = Block::new( 0, 0, vec![0; 32], 118318, "Genesis block!".to_owned(), 0x0000_ffff_ffff_ffff_ffff_ffff_ffff_ffff, ); assert_eq!(block.hash(), block.hash()); } #[test] fn test_mine_1() { let mut block = Block::new( 0, 0, vec![0; 32], 0, "Genesis block!".to_owned(), 0x0000_ffff_ffff_ffff_ffff_ffff_ffff_ffff, ); assert_eq!(block.mine(), block.mine()); } #[test] fn test_mine_2() { let mut block = Block::new( 0, 0, vec![0; 32], 118318, "Genesis block!".to_owned(), 0x0000_ffff_ffff_ffff_ffff_ffff_ffff_ffff, ); assert_eq!(block.mine(), block.mine()); } }
#[doc = r"Value read from the register"] pub struct R { bits: u16, } #[doc = r"Value to write to the register"] pub struct W { bits: u16, } impl super::DMACTL4 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W, { let bits = self.register.get(); self.register.set(f(&R { bits }, &mut W { bits }).bits); } #[doc = r"Reads the contents of the register"] #[inline(always)] pub fn read(&self) -> R { R { bits: self.register.get(), } } #[doc = r"Writes to the register"] #[inline(always)] pub fn write<F>(&self, f: F) where F: FnOnce(&mut W) -> &mut W, { self.register.set( f(&mut W { bits: Self::reset_value(), }) .bits, ); } #[doc = r"Reset value of the register"] #[inline(always)] pub const fn reset_value() -> u16 { 0 } #[doc = r"Writes the reset value to the register"] #[inline(always)] pub fn reset(&self) { self.register.set(Self::reset_value()) } } #[doc = r"Value of the field"] pub struct USB_DMACTL4_ENABLER { bits: bool, } impl USB_DMACTL4_ENABLER { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_DMACTL4_ENABLEW<'a> { w: &'a mut W, } impl<'a> _USB_DMACTL4_ENABLEW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 0); self.w.bits |= ((value as u16) & 1) << 0; self.w } } #[doc = r"Value of the field"] pub struct USB_DMACTL4_DIRR { bits: bool, } impl USB_DMACTL4_DIRR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_DMACTL4_DIRW<'a> { w: &'a mut W, } impl<'a> _USB_DMACTL4_DIRW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 1); self.w.bits |= ((value as u16) & 1) << 1; self.w } } #[doc = r"Value of the field"] pub struct USB_DMACTL4_MODER { bits: bool, } impl USB_DMACTL4_MODER { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_DMACTL4_MODEW<'a> { w: &'a mut W, } impl<'a> _USB_DMACTL4_MODEW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 2); self.w.bits |= ((value as u16) & 1) << 2; self.w } } #[doc = r"Value of the field"] pub struct USB_DMACTL4_IER { bits: bool, } impl USB_DMACTL4_IER { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_DMACTL4_IEW<'a> { w: &'a mut W, } impl<'a> _USB_DMACTL4_IEW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 3); self.w.bits |= ((value as u16) & 1) << 3; self.w } } #[doc = r"Value of the field"] pub struct USB_DMACTL4_EPR { bits: u8, } impl USB_DMACTL4_EPR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bits(&self) -> u8 { self.bits } } #[doc = r"Proxy"] pub struct _USB_DMACTL4_EPW<'a> { w: &'a mut W, } impl<'a> _USB_DMACTL4_EPW<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits &= !(15 << 4); self.w.bits |= ((value as u16) & 15) << 4; self.w } } #[doc = r"Value of the field"] pub struct USB_DMACTL4_ERRR { bits: bool, } impl USB_DMACTL4_ERRR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bit(&self) -> bool { self.bits } #[doc = r"Returns `true` if the bit is clear (0)"] #[inline(always)] pub fn bit_is_clear(&self) -> bool { !self.bit() } #[doc = r"Returns `true` if the bit is set (1)"] #[inline(always)] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r"Proxy"] pub struct _USB_DMACTL4_ERRW<'a> { w: &'a mut W, } impl<'a> _USB_DMACTL4_ERRW<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits &= !(1 << 8); self.w.bits |= ((value as u16) & 1) << 8; self.w } } #[doc = "Possible values of the field `USB_DMACTL4_BRSTM`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum USB_DMACTL4_BRSTMR { #[doc = "Bursts of unspecified length"] USB_DMACTL4_BRSTM_ANY, #[doc = "INCR4 or unspecified length"] USB_DMACTL4_BRSTM_INC4, #[doc = "INCR8, INCR4 or unspecified length"] USB_DMACTL4_BRSTM_INC8, #[doc = "INCR16, INCR8, INCR4 or unspecified length"] USB_DMACTL4_BRSTM_INC16, } impl USB_DMACTL4_BRSTMR { #[doc = r"Value of the field as raw bits"] #[inline(always)] pub fn bits(&self) -> u8 { match *self { USB_DMACTL4_BRSTMR::USB_DMACTL4_BRSTM_ANY => 0, USB_DMACTL4_BRSTMR::USB_DMACTL4_BRSTM_INC4 => 1, USB_DMACTL4_BRSTMR::USB_DMACTL4_BRSTM_INC8 => 2, USB_DMACTL4_BRSTMR::USB_DMACTL4_BRSTM_INC16 => 3, } } #[allow(missing_docs)] #[doc(hidden)] #[inline(always)] pub fn _from(value: u8) -> USB_DMACTL4_BRSTMR { match value { 0 => USB_DMACTL4_BRSTMR::USB_DMACTL4_BRSTM_ANY, 1 => USB_DMACTL4_BRSTMR::USB_DMACTL4_BRSTM_INC4, 2 => USB_DMACTL4_BRSTMR::USB_DMACTL4_BRSTM_INC8, 3 => USB_DMACTL4_BRSTMR::USB_DMACTL4_BRSTM_INC16, _ => unreachable!(), } } #[doc = "Checks if the value of the field is `USB_DMACTL4_BRSTM_ANY`"] #[inline(always)] pub fn is_usb_dmactl4_brstm_any(&self) -> bool { *self == USB_DMACTL4_BRSTMR::USB_DMACTL4_BRSTM_ANY } #[doc = "Checks if the value of the field is `USB_DMACTL4_BRSTM_INC4`"] #[inline(always)] pub fn is_usb_dmactl4_brstm_inc4(&self) -> bool { *self == USB_DMACTL4_BRSTMR::USB_DMACTL4_BRSTM_INC4 } #[doc = "Checks if the value of the field is `USB_DMACTL4_BRSTM_INC8`"] #[inline(always)] pub fn is_usb_dmactl4_brstm_inc8(&self) -> bool { *self == USB_DMACTL4_BRSTMR::USB_DMACTL4_BRSTM_INC8 } #[doc = "Checks if the value of the field is `USB_DMACTL4_BRSTM_INC16`"] #[inline(always)] pub fn is_usb_dmactl4_brstm_inc16(&self) -> bool { *self == USB_DMACTL4_BRSTMR::USB_DMACTL4_BRSTM_INC16 } } #[doc = "Values that can be written to the field `USB_DMACTL4_BRSTM`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum USB_DMACTL4_BRSTMW { #[doc = "Bursts of unspecified length"] USB_DMACTL4_BRSTM_ANY, #[doc = "INCR4 or unspecified length"] USB_DMACTL4_BRSTM_INC4, #[doc = "INCR8, INCR4 or unspecified length"] USB_DMACTL4_BRSTM_INC8, #[doc = "INCR16, INCR8, INCR4 or unspecified length"] USB_DMACTL4_BRSTM_INC16, } impl USB_DMACTL4_BRSTMW { #[allow(missing_docs)] #[doc(hidden)] #[inline(always)] pub fn _bits(&self) -> u8 { match *self { USB_DMACTL4_BRSTMW::USB_DMACTL4_BRSTM_ANY => 0, USB_DMACTL4_BRSTMW::USB_DMACTL4_BRSTM_INC4 => 1, USB_DMACTL4_BRSTMW::USB_DMACTL4_BRSTM_INC8 => 2, USB_DMACTL4_BRSTMW::USB_DMACTL4_BRSTM_INC16 => 3, } } } #[doc = r"Proxy"] pub struct _USB_DMACTL4_BRSTMW<'a> { w: &'a mut W, } impl<'a> _USB_DMACTL4_BRSTMW<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: USB_DMACTL4_BRSTMW) -> &'a mut W { { self.bits(variant._bits()) } } #[doc = "Bursts of unspecified length"] #[inline(always)] pub fn usb_dmactl4_brstm_any(self) -> &'a mut W { self.variant(USB_DMACTL4_BRSTMW::USB_DMACTL4_BRSTM_ANY) } #[doc = "INCR4 or unspecified length"] #[inline(always)] pub fn usb_dmactl4_brstm_inc4(self) -> &'a mut W { self.variant(USB_DMACTL4_BRSTMW::USB_DMACTL4_BRSTM_INC4) } #[doc = "INCR8, INCR4 or unspecified length"] #[inline(always)] pub fn usb_dmactl4_brstm_inc8(self) -> &'a mut W { self.variant(USB_DMACTL4_BRSTMW::USB_DMACTL4_BRSTM_INC8) } #[doc = "INCR16, INCR8, INCR4 or unspecified length"] #[inline(always)] pub fn usb_dmactl4_brstm_inc16(self) -> &'a mut W { self.variant(USB_DMACTL4_BRSTMW::USB_DMACTL4_BRSTM_INC16) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bits(self, value: u8) -> &'a mut W { self.w.bits &= !(3 << 9); self.w.bits |= ((value as u16) & 3) << 9; self.w } } impl R { #[doc = r"Value of the register as raw bits"] #[inline(always)] pub fn bits(&self) -> u16 { self.bits } #[doc = "Bit 0 - DMA Transfer Enable"] #[inline(always)] pub fn usb_dmactl4_enable(&self) -> USB_DMACTL4_ENABLER { let bits = ((self.bits >> 0) & 1) != 0; USB_DMACTL4_ENABLER { bits } } #[doc = "Bit 1 - DMA Direction"] #[inline(always)] pub fn usb_dmactl4_dir(&self) -> USB_DMACTL4_DIRR { let bits = ((self.bits >> 1) & 1) != 0; USB_DMACTL4_DIRR { bits } } #[doc = "Bit 2 - DMA Transfer Mode"] #[inline(always)] pub fn usb_dmactl4_mode(&self) -> USB_DMACTL4_MODER { let bits = ((self.bits >> 2) & 1) != 0; USB_DMACTL4_MODER { bits } } #[doc = "Bit 3 - DMA Interrupt Enable"] #[inline(always)] pub fn usb_dmactl4_ie(&self) -> USB_DMACTL4_IER { let bits = ((self.bits >> 3) & 1) != 0; USB_DMACTL4_IER { bits } } #[doc = "Bits 4:7 - Endpoint number"] #[inline(always)] pub fn usb_dmactl4_ep(&self) -> USB_DMACTL4_EPR { let bits = ((self.bits >> 4) & 15) as u8; USB_DMACTL4_EPR { bits } } #[doc = "Bit 8 - Bus Error Bit"] #[inline(always)] pub fn usb_dmactl4_err(&self) -> USB_DMACTL4_ERRR { let bits = ((self.bits >> 8) & 1) != 0; USB_DMACTL4_ERRR { bits } } #[doc = "Bits 9:10 - Burst Mode"] #[inline(always)] pub fn usb_dmactl4_brstm(&self) -> USB_DMACTL4_BRSTMR { USB_DMACTL4_BRSTMR::_from(((self.bits >> 9) & 3) as u8) } } impl W { #[doc = r"Writes raw bits to the register"] #[inline(always)] pub unsafe fn bits(&mut self, bits: u16) -> &mut Self { self.bits = bits; self } #[doc = "Bit 0 - DMA Transfer Enable"] #[inline(always)] pub fn usb_dmactl4_enable(&mut self) -> _USB_DMACTL4_ENABLEW { _USB_DMACTL4_ENABLEW { w: self } } #[doc = "Bit 1 - DMA Direction"] #[inline(always)] pub fn usb_dmactl4_dir(&mut self) -> _USB_DMACTL4_DIRW { _USB_DMACTL4_DIRW { w: self } } #[doc = "Bit 2 - DMA Transfer Mode"] #[inline(always)] pub fn usb_dmactl4_mode(&mut self) -> _USB_DMACTL4_MODEW { _USB_DMACTL4_MODEW { w: self } } #[doc = "Bit 3 - DMA Interrupt Enable"] #[inline(always)] pub fn usb_dmactl4_ie(&mut self) -> _USB_DMACTL4_IEW { _USB_DMACTL4_IEW { w: self } } #[doc = "Bits 4:7 - Endpoint number"] #[inline(always)] pub fn usb_dmactl4_ep(&mut self) -> _USB_DMACTL4_EPW { _USB_DMACTL4_EPW { w: self } } #[doc = "Bit 8 - Bus Error Bit"] #[inline(always)] pub fn usb_dmactl4_err(&mut self) -> _USB_DMACTL4_ERRW { _USB_DMACTL4_ERRW { w: self } } #[doc = "Bits 9:10 - Burst Mode"] #[inline(always)] pub fn usb_dmactl4_brstm(&mut self) -> _USB_DMACTL4_BRSTMW { _USB_DMACTL4_BRSTMW { w: self } } }
//! This module contains a wide variety of helper functions and structures that have //! no consistent theme. //! //! #![allow(unused)] use std::time::{Instant, Duration}; /// StopWatch is an Instant helper function used for timing. /// /// ## Example /// ``` /// let sw = StopWatch::new(); /// /// for i in 0..50{ /// sw.reset_lap_timer(); /// /// // Do some work. /// /// let lap_time = sw.lap_time(); /// } /// /// let time_since_initial = sw.get_time(); /// ``` pub struct StopWatch{ global_timer: Instant, lap_timer: Option<Instant>, } impl StopWatch{ pub fn new()->StopWatch{ return StopWatch{ global_timer: Instant::now(), lap_timer: None}; } pub fn get_time(&self)->Duration{ return self.global_timer.elapsed(); } pub fn lap_time(&self)->Duration{ match self.lap_timer{ Some(ref lap_timer)=>{ return lap_timer.elapsed(); }, _=>{ return self.get_time(); } } } pub fn reset_lap_timer(&mut self){ self.lap_timer = Some(Instant::now()); } pub fn reset(&mut self){ self.global_timer = Instant::now(); self.reset_lap_timer(); } } /// Returns true if (x, y) are in the given rectangle. pub fn in_rect(x: i32, y: i32, rect: [i32;4])->bool{ let mut rt = true; if x < rect[0]{ rt = false; } if y < rect[1]{ rt = false; } if x > rect[0] + rect[2]{ rt = false; } if y > rect[1] + rect[3]{ rt = false; } return rt; } /// Returns the over lapping area of the two given rectangles. pub fn overlap_rect_area(rect1: [i32;4], rect2: [i32;4])->i32{ let ol_x = i32::max(0, i32::min(rect1[0]+rect1[2], rect2[0]+rect2[2]) - i32::max(rect1[0], rect2[0])); let ol_y = i32::max(0, i32::min(rect1[1]+rect1[3], rect2[1]+rect2[3]) - i32::max(rect1[1], rect2[1])); return ol_x * ol_y; } #[test] fn rect_overlap_test(){ let one = overlap_rect_area( [0, 0, 50, 50], [15, 15, 25, 25], ); assert_eq!(one, 25*25); let two = overlap_rect_area( [0, 0, 25, 25], [-15, -15, 50, 50], ); assert_eq!(two, 25*25); let three = overlap_rect_area( [0, 0, 50, 50], [25, 25, 50, 50], ); assert_eq!(three, 25*25); let four = overlap_rect_area( [25, 25, 50, 50], [0, 0, 50, 50], ); assert_eq!(four, 25*25); } static mut RANDOM_NUMBER_INDEX: usize = 0; /// Seeds the initial index when misc get_rand functions. pub fn set_seed( seed: usize){unsafe{ RANDOM_NUMBER_INDEX = seed; }} /// Returns a random usize from `RANDOM_NUMBERS`. pub fn get_random()->usize{unsafe{ let rt = RANDOM_NUMBERS[RANDOM_NUMBER_INDEX % RANDOM_NUMBERS.len()]; RANDOM_NUMBER_INDEX += 1; return rt; }} /// Returns a random f32 from `RANDOM_NUMBERS`, where the bounds are given by /// (plus_and_minus, -1*plus_and_minus). pub fn get_randf32_pm(plus_and_minus: f32)->f32{ let rt = get_randf32(-1f32*plus_and_minus, plus_and_minus); return rt; } /// Returns a random f32 from `RANDOM_NUMBERS`. where the bounds are given by min, and max. pub fn get_randf32(min: f32, max: f32)->f32{ let mut rt = get_random() as f32 / 99999.0; let rt = rt * (max - min) + min; return rt; } /// Returns a random i32 from `RANDOM_NUMBERS`. where the bounds are given by min, and max. pub fn get_randi32(min: i32, max: i32)->i32{ let mut rt = get_random() as f32 / 99999.0; let rt = (rt * (max - min) as f32) as i32 + min; return rt; } /// This is an array of random numbers generated by NIST, [link](https://www.nist.gov/system/files/documents/2017/04/28/AppenB-HB133-05-Z.pdf). //https://www.nist.gov/system/files/documents/2017/04/28/AppenB-HB133-05-Z.pdf const RANDOM_NUMBERS: [usize; 500] = [ 11164, 36318, 75061, 37674, 26320, 75100, 10431, 20418, 19228, 91792 , 21215, 91791, 76831, 58678, 87054, 31687, 93205, 43685, 19732, 08468 , 10438, 44482, 66558, 37649, 08882, 90870, 12462, 41810, 01806, 02977 , 36792, 26236, 33266, 66583, 60881, 97395, 20461, 36742, 02852, 50564 , 73944, 04773, 12032, 51414, 82384, 38370, 00249, 80709, 72605, 67497 , 49563, 12872, 14063, 93104, 78483, 72717, 68714, 18048, 25005, 04151 , 64208, 48237, 41701, 73117, 33242, 42314, 83049, 21933, 92813, 04763 , 51486, 72875, 38605, 29341, 80749, 80151, 33835, 52602, 79147, 08868 , 99756, 26360, 64516, 17971, 48478, 09610, 04638, 17141, 09227, 10606 , 71325, 55217, 13015, 72907, 00431, 45117, 33827, 92873, 02953, 85474 , 65285, 97198, 12138, 53010, 94601, 15838, 16805, 61004, 43516, 17020 , 17264, 57327, 38224, 29301, 31381, 38109, 34976, 65692, 98566, 29550 , 95639, 99754, 31199, 92558, 68368, 04985, 51092, 37780, 40261, 14479 , 61555, 76404, 86210, 11808, 12841, 45147, 97438, 60022, 12645, 62000 , 78137, 98768, 04689, 87130, 79225, 08153, 84967, 64539, 79493, 74917 , 62490, 99215, 84987, 28759, 19177, 14733, 24550, 28067, 68894, 38490 , 24216, 63444, 21283, 07044, 92729, 37284, 13211, 37485, 10415, 36457 , 16975, 95428, 33226, 55903, 31605, 43817, 22250, 03918, 46999, 98501 , 59138, 39542, 71168, 57609, 91510, 77904, 74244, 50940, 31553, 62562 , 29478, 59652, 50414, 31966, 87912, 87154, 12944, 49862, 96566, 48825 , 96155, 95009, 27429, 72918, 08457, 78134, 48407, 26061, 58754, 05326 , 29621, 66583, 62966, 12468, 20245, 14015, 04014, 35713, 03980, 03024 , 12639, 75291, 71020, 17265, 41598, 64074, 64629, 63293, 53307, 48766 , 14544, 37134, 54714, 02401, 63228, 26831, 19386, 15457, 17999, 18306 , 83403, 88827, 09834, 11333, 68431, 31706, 26652, 04711, 34593, 22561 , 67642, 05204, 30697, 44806, 96989, 68403, 85621, 45556, 35434, 09532 , 64041, 99011, 14610, 40273, 09482, 62864, 01573, 82274, 81446, 32477 , 17048, 94523, 97444, 59904, 16936, 39384, 97551, 09620, 63932, 03091 , 93039, 89416, 52795, 10631, 09728, 68202, 20963, 02477, 55494, 39563 , 82244, 34392, 96607, 17220, 51984, 10753, 76272, 50985, 97593, 34320 , 96990, 55244, 70693, 25255, 40029, 23289, 48819, 07159, 60172, 81697 , 09119, 74803, 97303, 88701, 51380, 73143, 98251, 78635, 27556, 20712 , 57666, 41204, 47589, 78364, 38266, 94393, 70713, 53388, 79865, 92069 , 46492, 61594, 26729, 58272, 81754, 14648, 77210, 12923, 53712, 87771 , 08433, 19172, 08320, 20839, 13715, 10597, 17234, 39355, 74816, 03363 , 10011, 75004, 86054, 41190, 10061, 19660, 03500, 68412, 57812, 57929 , 92420, 65431, 16530, 05547, 10683, 88102, 30176, 84750, 10115, 69220 , 35542, 55865, 07304, 47010, 43233, 57022, 52161, 82976, 47981, 46588 , 86595, 26247, 18552, 29491, 33712, 32285, 64844, 69395, 41387, 87195 , 72115, 34985, 58036, 99137, 47482, 06204, 24138, 24272, 16196, 04393 , 07428, 58863, 96023, 88936, 51343, 70958, 96768, 74317, 27176, 29600 , 35379, 27922, 28906, 55013, 26937, 48174, 04197, 36074, 65315, 12537 , 10982, 22807, 10920, 26299, 23593, 64629, 57801, 10437, 43965, 15344 , 90127, 33341, 77806, 12446, 15444, 49244, 47277, 11346, 15884, 28131 , 63002, 12990, 23510, 68774, 48983, 20481, 59815, 67248, 17076, 78910 , 40779, 86382, 48454, 65269, 91239, 45989, 45389, 54847, 77919, 41105 , 43216, 12608, 18167, 84631, 94058, 82458, 15139, 76856, 86019, 47928 , 96167, 64375, 74108, 93643, 09204, 98855, 59051, 56492, 11933, 64958 , 70975, 62693, 35684, 72607, 23026, 37004, 32989, 24843, 01128, 74658 , 85812, 61875, 23570, 75754, 29090, 40264, 80399, 47254, 40135, 69916 ];
use std::{fs, path::Path}; use eyre::Result; use proc_macro2::{Punct, Spacing}; use quote::{format_ident, quote}; use serde::{Deserialize, Serialize}; use ungrammar::Grammar; use xshell::cmd; use crate::utils; #[derive(Debug, Serialize, Deserialize)] pub struct KindsSrc { punct: Vec<(String, String)>, keywords: Vec<String>, literals: Vec<String>, tokens: Vec<String>, nodes: Vec<String>, } impl KindsSrc { pub fn get() -> Result<KindsSrc> { let s = fs::read_to_string(utils::xtask_root().join("assets/ast_src.toml"))?; let kinds: KindsSrc = toml::from_str(&s)?; Ok(kinds) } pub fn gen_syntax_kinds(&self) -> Result<String> { let (punctuation_matches, punctuation): (Vec<_>, Vec<_>) = self .punct .iter() .map(|(token, name)| { let value = if "{}[]()".contains(token) { let c = token.chars().next().unwrap(); quote! { #c } } else { let cs = token.chars().map(|c| Punct::new(c, Spacing::Joint)); quote! { #(#cs)* } }; (value, format_ident!("{}", name)) }) .unzip(); let keywords: Vec<_> = self .keywords .iter() .map(|keyword| format_ident!("{}Kw", to_camel_case(keyword))) .collect(); let keyword_matches: Vec<_> = self .keywords .iter() .map(|keyword| format_ident!("{}", keyword)) .collect(); let literal_matches: Vec<_> = self .literals .iter() .map(|literal| format_ident!("{}", literal)) .collect(); let literals: Vec<_> = self .literals .iter() .map(|literal| format_ident!("{}Lit", to_camel_case(literal))) .collect(); let tokens = self .tokens .iter() .map(|name| format_ident!("{}", name)) .collect::<Vec<_>>(); let nodes = self.nodes.iter().map(|node| format_ident!("{}", node)); let ast = quote! { #![allow(bad_style, missing_docs, unreachable_pub)] /// The kind of syntax node, e.g. Ident, `UseKw`, or `Struct`. #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] #[repr(u16)] pub enum SyntaxKind { // Technical SyntaxKinds: they appear temporally during parsing, // but never end up in the final tree #[doc(hidden)] Tombstone, #[doc(hidden)] Eof, #(#punctuation,)* #(#keywords,)* #(#literals,)* #(#tokens,)* #(#nodes,)* // #(#tokens,)* // #(#nodes,)* // Technical kind so that we can cast from u16 safely #[doc(hidden)] __LAST, } /// A helper macro to get the SyntaxKind #[macro_export] macro_rules! T { #([#punctuation_matches] => { $crate::SyntaxKind::#punctuation };)* #([#keyword_matches] => { $crate::SyntaxKind::#keywords};)* #([#literal_matches] => { $crate::SyntaxKind::#literals};)* [ident] => { $crate::SyntaxKind::Ident }; [__] => { $crate::SyntaxKind::Tombstone }; [eof] => { $crate::SyntaxKind::Eof }; } }; Ok(reformat(&ast.to_string())?) } } pub const PREAMBLE: &str = "Generated file, do not edit by hand, see `xtask/src/codegen`"; pub fn reformat(text: &str) -> Result<String> { let stdout = cmd!("rustfmt").stdin(text).read()?; Ok(format!("//! {}\n\n{}\n", PREAMBLE, stdout)) } pub fn to_camel_case(s: &str) -> String { let mut buf = String::with_capacity(s.len()); let (idx, first) = s.char_indices().next().unwrap(); buf.push(first.to_ascii_uppercase()); buf.push_str(&s[idx + 1..]); buf } fn lingo_grammar() -> Result<Grammar> { let grammar_path = utils::xtask_root().join("assets/lingo.ungram"); let src = fs::read_to_string(grammar_path)?; Ok(src.parse()?) }
use crate::render::systems; use bevy::prelude::*; /// Plugin responsible for creating meshes to render the Rapier physics scene. pub struct RapierRenderPlugin; impl Plugin for RapierRenderPlugin { fn build(&self, app: &mut AppBuilder) { app.add_system_to_stage( stage::PRE_UPDATE, systems::create_collider_renders_system.system(), ); } }
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[cfg(feature = "Win32_Data_Xml_MsXml")] pub mod MsXml; #[cfg(feature = "Win32_Data_Xml_XmlLite")] pub mod XmlLite;
extern crate libc; use std::env; use std::ffi::CString; #[link(name = "tts")] extern { fn tts_init() -> i32; fn tts_msg(msg: *const libc::c_char) -> i32; fn tts_close() -> i32; } fn main() { if env::args().len() < 2{ println!("ERROR: wrong number of command-line arguments."); println!("USAGE: my-tts message"); std::process::exit(1); } let message = env::args().nth(1).unwrap(); let message_c = CString::new(message).unwrap(); unsafe { tts_init(); tts_msg(message_c.as_ptr()); tts_close(); } }
pub struct NumArray { nums: Vec<i32>, tree: Vec<i32>, } impl NumArray { pub fn new(nums: Vec<i32>) -> Self { let mut tree = nums.clone(); let mut p = 1; let mut q = 2; while p < tree.len() { let mut i = 0; while i + p < tree.len() { tree[i] += tree[i | p]; i += q; } p <<= 1; q <<= 1; } Self { nums, tree } } pub fn update(&mut self, i: i32, val: i32) { let mut i = i as usize; let d = val - self.nums[i]; self.nums[i] = val; let mut p = 1; loop { self.tree[i] += d; if i == 0 { return; } while i & p == 0 { p <<= 1; } i ^= p; } } pub fn sum_range(&self, i: i32, j: i32) -> i32 { self.sum_from(i) - self.sum_from(j + 1) } fn sum_from(&self, i: i32) -> i32 { if i == 0 { return self.tree[0]; } let mut sum = 0; let mut i = i as usize; let mut p = 1; while i < self.tree.len() { sum += self.tree[i]; while i & p == 0 { p <<= 1; } i += p; } sum } } #[test] fn test0307() { let mut obj = NumArray::new(vec![1, 3, 5]); assert_eq!(obj.sum_range(0, 2), 9); obj.update(1, 2); assert_eq!(obj.sum_range(0, 2), 8); }
pub type DeviceConfiguration = libk4a_sys::k4a_device_configuration_t; pub type DepthMode = libk4a_sys::k4a_depth_mode_t; pub type ColorResolution = libk4a_sys::k4a_color_resolution_t;
#![allow(dead_code, unused_imports)] use shipyard::*; use shipyard_scenegraph::prelude::*; use std::borrow::{Borrow, BorrowMut}; use std::collections::{hash_map::Entry, HashMap}; use std::hash::Hash; mod helpers; use helpers::*; #[test] fn test_transform_dirty() { let (world, entities, _labels) = create_scene_graph(); let (root, a, b, c, d, e, f, g, h, i, j, k, l, m, n) = entities; world.run(local_transform_sys); world.run(world_transform_sys); //check all the world transforms before making changes { let world_storage = world.borrow::<View<WorldTransform>>().unwrap(); let world_transform = (&world_storage).get(root).unwrap(); assert_eq!(Vec3::new(0.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(a).unwrap(); assert_eq!(Vec3::new(10.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(b).unwrap(); assert_eq!(Vec3::new(10.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(c).unwrap(); assert_eq!(Vec3::new(10.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(d).unwrap(); assert_eq!(Vec3::new(20.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(e).unwrap(); assert_eq!(Vec3::new(20.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(f).unwrap(); assert_eq!(Vec3::new(20.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(g).unwrap(); assert_eq!(Vec3::new(30.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(h).unwrap(); assert_eq!(Vec3::new(30.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(i).unwrap(); assert_eq!(Vec3::new(30.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(j).unwrap(); assert_eq!(Vec3::new(50.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(k).unwrap(); assert_eq!(Vec3::new(40.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(l).unwrap(); assert_eq!(Vec3::new(40.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(m).unwrap(); assert_eq!(Vec3::new(60.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(n).unwrap(); assert_eq!(Vec3::new(70.0, 0.0, 0.0), get_translation(&world_transform)); } //nothing should be dirty { let (translations, rotations, scales, origins, dirty) = world .borrow::<( View<Translation>, View<Rotation>, View<Scale>, View<Origin>, View<DirtyTransform>, )>() .unwrap(); let tlen = translations.modified().iter().count(); let rlen = rotations.modified().iter().count(); let slen = scales.modified().iter().count(); let olen = origins.modified().iter().count(); let dlen = dirty.iter().into_iter().filter(|x| x.0).count(); assert_eq!(tlen, 0); assert_eq!(tlen, rlen); assert_eq!(tlen, slen); assert_eq!(tlen, olen); assert_eq!(dlen, 0); } //make a change { let mut translations = world.borrow::<ViewMut<Translation>>().unwrap(); let mut translation = (&mut translations).get(a).unwrap(); translation.set_y(200.0); let mut translation = (&mut translations).get(g).unwrap(); translation.set_y(300.0); let mut translation = (&mut translations).get(m).unwrap(); translation.set_y(400.0); } //they should be ready to be dirtied, but not yet dirty { let (translations, dirty) = world .borrow::<(View<Translation>, View<DirtyTransform>)>() .unwrap(); let tlen = translations.modified().iter().count(); let dlen = dirty.iter().into_iter().filter(|x| x.0).count(); assert_eq!(tlen, 3); assert_eq!(dlen, 0); } world.run(local_transform_sys); //they should be dirtied, but no longer pending { let (translations, dirty) = world .borrow::<(View<Translation>, View<DirtyTransform>)>() .unwrap(); let tlen = translations.modified().iter().count(); let dlen = dirty.iter().into_iter().filter(|x| x.0).count(); assert_eq!(tlen, 0); assert_eq!(dlen, 3); } world.run(world_transform_sys); //again, back to normal - nothing should be dirty { let (translations, rotations, scales, origins, dirty) = world .borrow::<( View<Translation>, View<Rotation>, View<Scale>, View<Origin>, View<DirtyTransform>, )>() .unwrap(); let tlen = translations.modified().iter().count(); let rlen = rotations.modified().iter().count(); let slen = scales.modified().iter().count(); let olen = origins.modified().iter().count(); let dlen = dirty.iter().into_iter().filter(|x| x.0).count(); assert_eq!(tlen, 0); assert_eq!(tlen, rlen); assert_eq!(tlen, slen); assert_eq!(tlen, olen); assert_eq!(dlen, 0); } //check all the transforms after making changes { let world_storage = world.borrow::<View<WorldTransform>>().unwrap(); let world_transform = (&world_storage).get(root).unwrap(); assert_eq!(Vec3::new(0.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(a).unwrap(); assert_eq!( Vec3::new(10.0, 200.0, 0.0), get_translation(&world_transform) ); let world_transform = (&world_storage).get(b).unwrap(); assert_eq!(Vec3::new(10.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(c).unwrap(); assert_eq!(Vec3::new(10.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(d).unwrap(); assert_eq!( Vec3::new(20.0, 200.0, 0.0), get_translation(&world_transform) ); let world_transform = (&world_storage).get(e).unwrap(); assert_eq!( Vec3::new(20.0, 200.0, 0.0), get_translation(&world_transform) ); let world_transform = (&world_storage).get(f).unwrap(); assert_eq!(Vec3::new(20.0, 0.0, 0.0), get_translation(&world_transform)); let world_transform = (&world_storage).get(g).unwrap(); assert_eq!( Vec3::new(30.0, 300.0, 0.0), get_translation(&world_transform) ); let world_transform = (&world_storage).get(h).unwrap(); assert_eq!( Vec3::new(30.0, 200.0, 0.0), get_translation(&world_transform) ); let world_transform = (&world_storage).get(i).unwrap(); assert_eq!( Vec3::new(30.0, 200.0, 0.0), get_translation(&world_transform) ); let world_transform = (&world_storage).get(j).unwrap(); assert_eq!( Vec3::new(50.0, 300.0, 0.0), get_translation(&world_transform) ); let world_transform = (&world_storage).get(k).unwrap(); assert_eq!( Vec3::new(40.0, 300.0, 0.0), get_translation(&world_transform) ); let world_transform = (&world_storage).get(l).unwrap(); assert_eq!( Vec3::new(40.0, 200.0, 0.0), get_translation(&world_transform) ); let world_transform = (&world_storage).get(m).unwrap(); assert_eq!( Vec3::new(60.0, 700.0, 0.0), get_translation(&world_transform) ); let world_transform = (&world_storage).get(n).unwrap(); assert_eq!( Vec3::new(70.0, 700.0, 0.0), get_translation(&world_transform) ); } }
use std::fs::File; use std::io; use std::io::prelude::*; use std::path::{Path, PathBuf}; use serde::{Deserialize, Serialize}; use crate::error::FatalError; pub trait ConfigSource { fn exclude_paths(&self) -> Option<&[String]> { None } fn sign_commit(&self) -> Option<bool> { None } fn sign_tag(&self) -> Option<bool> { None } fn push_remote(&self) -> Option<&str> { None } fn registry(&self) -> Option<&str> { None } fn disable_publish(&self) -> Option<bool> { None } fn disable_push(&self) -> Option<bool> { None } fn dev_version_ext(&self) -> Option<&str> { None } fn no_dev_version(&self) -> Option<bool> { None } fn consolidate_commits(&self) -> Option<bool> { None } fn pre_release_commit_message(&self) -> Option<&str> { None } // depreacted fn pro_release_commit_message(&self) -> Option<&str> { None } fn post_release_commit_message(&self) -> Option<&str> { None } fn pre_release_replacements(&self) -> Option<&[Replace]> { None } fn post_release_replacements(&self) -> Option<&[Replace]> { None } fn pre_release_hook(&self) -> Option<&Command> { None } fn tag_message(&self) -> Option<&str> { None } fn tag_prefix(&self) -> Option<&str> { None } fn tag_name(&self) -> Option<&str> { None } fn disable_tag(&self) -> Option<bool> { None } fn enable_features(&self) -> Option<&[String]> { None } fn enable_all_features(&self) -> Option<bool> { None } fn dependent_version(&self) -> Option<DependentVersion> { None } } #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(deny_unknown_fields, default)] #[serde(rename_all = "kebab-case")] pub struct Config { pub exclude_paths: Option<Vec<String>>, pub sign_commit: Option<bool>, pub sign_tag: Option<bool>, pub push_remote: Option<String>, pub registry: Option<String>, pub disable_publish: Option<bool>, pub disable_push: Option<bool>, pub dev_version_ext: Option<String>, pub no_dev_version: Option<bool>, pub consolidate_commits: Option<bool>, pub pre_release_commit_message: Option<String>, // depreacted pub pro_release_commit_message: Option<String>, pub post_release_commit_message: Option<String>, pub pre_release_replacements: Option<Vec<Replace>>, pub post_release_replacements: Option<Vec<Replace>>, pub pre_release_hook: Option<Command>, pub tag_message: Option<String>, pub tag_prefix: Option<String>, pub tag_name: Option<String>, pub disable_tag: Option<bool>, pub enable_features: Option<Vec<String>>, pub enable_all_features: Option<bool>, pub dependent_version: Option<DependentVersion>, } impl Config { pub fn update(&mut self, source: &dyn ConfigSource) { if let Some(exclude_paths) = source.exclude_paths() { self.exclude_paths = Some(exclude_paths.to_vec()); } if let Some(sign_commit) = source.sign_commit() { self.sign_commit = Some(sign_commit); } if let Some(sign_tag) = source.sign_tag() { self.sign_tag = Some(sign_tag); } if let Some(push_remote) = source.push_remote() { self.push_remote = Some(push_remote.to_owned()); } if let Some(registry) = source.registry() { self.registry = Some(registry.to_owned()); } if let Some(disable_publish) = source.disable_publish() { self.disable_publish = Some(disable_publish); } if let Some(disable_push) = source.disable_push() { self.disable_push = Some(disable_push); } if let Some(dev_version_ext) = source.dev_version_ext() { self.dev_version_ext = Some(dev_version_ext.to_owned()); } if let Some(no_dev_version) = source.no_dev_version() { self.no_dev_version = Some(no_dev_version); } if let Some(consolidate_commits) = source.consolidate_commits() { self.consolidate_commits = Some(consolidate_commits); } if let Some(pre_release_commit_message) = source.pre_release_commit_message() { self.pre_release_commit_message = Some(pre_release_commit_message.to_owned()); } // depreacted if let Some(pro_release_commit_message) = source.pro_release_commit_message() { log::warn!( "pro_release_commit_message is deprecated, use post-release-commit-message instead" ); self.post_release_commit_message = Some(pro_release_commit_message.to_owned()); } if let Some(post_release_commit_message) = source.post_release_commit_message() { self.post_release_commit_message = Some(post_release_commit_message.to_owned()); } if let Some(pre_release_replacements) = source.pre_release_replacements() { self.pre_release_replacements = Some(pre_release_replacements.to_owned()); } if let Some(post_release_replacements) = source.post_release_replacements() { self.post_release_replacements = Some(post_release_replacements.to_owned()); } if let Some(pre_release_hook) = source.pre_release_hook() { self.pre_release_hook = Some(pre_release_hook.to_owned()); } if let Some(tag_message) = source.tag_message() { self.tag_message = Some(tag_message.to_owned()); } if let Some(tag_prefix) = source.tag_prefix() { self.tag_prefix = Some(tag_prefix.to_owned()); } if let Some(tag_name) = source.tag_name() { self.tag_name = Some(tag_name.to_owned()); } if let Some(disable_tag) = source.disable_tag() { self.disable_tag = Some(disable_tag); } if let Some(enable_features) = source.enable_features() { self.enable_features = Some(enable_features.to_owned()); } if let Some(enable_all_features) = source.enable_all_features() { self.enable_all_features = Some(enable_all_features); } if let Some(dependent_version) = source.dependent_version() { self.dependent_version = Some(dependent_version); } } pub fn exclude_paths(&self) -> Option<&[String]> { self.exclude_paths.as_ref().map(|v| v.as_ref()) } pub fn sign_commit(&self) -> bool { self.sign_commit.unwrap_or(false) } pub fn sign_tag(&self) -> bool { self.sign_tag.unwrap_or(false) } pub fn push_remote(&self) -> &str { self.push_remote .as_ref() .map(|s| s.as_str()) .unwrap_or("origin") } pub fn registry(&self) -> Option<&str> { self.registry.as_ref().map(|s| s.as_str()) } pub fn disable_publish(&self) -> bool { self.disable_publish.unwrap_or(false) } pub fn disable_push(&self) -> bool { self.disable_push.unwrap_or(false) } pub fn dev_version_ext(&self) -> &str { self.dev_version_ext .as_ref() .map(|s| s.as_str()) .unwrap_or("alpha.0") } pub fn no_dev_version(&self) -> bool { self.no_dev_version.unwrap_or(false) } pub fn consolidate_commits(&self) -> bool { self.consolidate_commits.unwrap_or(false) } pub fn pre_release_commit_message(&self) -> &str { self.pre_release_commit_message .as_ref() .map(|s| s.as_str()) .unwrap_or("(cargo-release) version {{version}}") } pub fn post_release_commit_message(&self) -> &str { self.post_release_commit_message .as_ref() .map(|s| s.as_str()) .unwrap_or("(cargo-release) start next development iteration {{next_version}}") } pub fn pre_release_replacements(&self) -> &[Replace] { self.pre_release_replacements .as_ref() .map(|v| v.as_ref()) .unwrap_or(&[]) } pub fn post_release_replacements(&self) -> &[Replace] { self.post_release_replacements .as_ref() .map(|v| v.as_ref()) .unwrap_or(&[]) } pub fn pre_release_hook(&self) -> Option<&Command> { self.pre_release_hook.as_ref() } pub fn tag_message(&self) -> &str { self.tag_message .as_ref() .map(|s| s.as_str()) .unwrap_or("(cargo-release) {{crate_name}} version {{version}}") } pub fn tag_prefix(&self, is_root: bool) -> &str { // crate_name as default tag prefix for multi-crate project self.tag_prefix .as_ref() .map(|s| s.as_str()) .unwrap_or_else(|| if !is_root { "{{crate_name}}-" } else { "" }) } pub fn tag_name(&self) -> &str { self.tag_name .as_ref() .map(|s| s.as_str()) .unwrap_or("{{prefix}}v{{version}}") } pub fn disable_tag(&self) -> bool { self.disable_tag.unwrap_or(false) } pub fn enable_features(&self) -> &[String] { self.enable_features .as_ref() .map(|v| v.as_ref()) .unwrap_or(&[]) } pub fn enable_all_features(&self) -> bool { self.enable_all_features.unwrap_or(false) } pub fn dependent_version(&self) -> DependentVersion { self.dependent_version.unwrap_or_default() } } impl ConfigSource for Config { fn exclude_paths(&self) -> Option<&[String]> { self.exclude_paths.as_ref().map(|v| v.as_ref()) } fn sign_commit(&self) -> Option<bool> { self.sign_commit } fn sign_tag(&self) -> Option<bool> { self.sign_tag } fn push_remote(&self) -> Option<&str> { self.push_remote.as_ref().map(|s| s.as_str()) } fn registry(&self) -> Option<&str> { self.registry.as_ref().map(|s| s.as_str()) } fn disable_publish(&self) -> Option<bool> { self.disable_publish } fn disable_push(&self) -> Option<bool> { self.disable_push } fn dev_version_ext(&self) -> Option<&str> { self.dev_version_ext.as_ref().map(|s| s.as_str()) } fn no_dev_version(&self) -> Option<bool> { self.no_dev_version } fn consolidate_commits(&self) -> Option<bool> { self.consolidate_commits } fn pre_release_commit_message(&self) -> Option<&str> { self.pre_release_commit_message.as_ref().map(|s| s.as_str()) } // deprecated fn pro_release_commit_message(&self) -> Option<&str> { self.pro_release_commit_message.as_ref().map(|s| s.as_str()) } fn post_release_commit_message(&self) -> Option<&str> { self.post_release_commit_message .as_ref() .map(|s| s.as_str()) } fn pre_release_replacements(&self) -> Option<&[Replace]> { self.pre_release_replacements.as_ref().map(|v| v.as_ref()) } fn post_release_replacements(&self) -> Option<&[Replace]> { self.post_release_replacements.as_ref().map(|v| v.as_ref()) } fn pre_release_hook(&self) -> Option<&Command> { self.pre_release_hook.as_ref() } fn tag_message(&self) -> Option<&str> { self.tag_message.as_ref().map(|s| s.as_str()) } fn tag_prefix(&self) -> Option<&str> { self.tag_prefix.as_ref().map(|s| s.as_str()) } fn tag_name(&self) -> Option<&str> { self.tag_name.as_ref().map(|s| s.as_str()) } fn disable_tag(&self) -> Option<bool> { self.disable_tag } fn enable_features(&self) -> Option<&[String]> { self.enable_features.as_ref().map(|v| v.as_ref()) } fn enable_all_features(&self) -> Option<bool> { self.enable_all_features } fn dependent_version(&self) -> Option<DependentVersion> { self.dependent_version } } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(deny_unknown_fields)] pub struct Replace { pub file: PathBuf, pub search: String, pub replace: String, pub min: Option<usize>, pub max: Option<usize>, pub exactly: Option<usize>, #[serde(default)] pub prerelease: bool, } #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum Command { Line(String), Args(Vec<String>), } impl Command { pub fn args(&self) -> Vec<&str> { match self { Command::Line(ref s) => vec![s.as_str()], Command::Args(ref a) => a.iter().map(|s| s.as_str()).collect(), } } } arg_enum! { #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "kebab-case")] pub enum DependentVersion { Upgrade, Fix, Error, Warn, Ignore, } } impl Default for DependentVersion { fn default() -> Self { DependentVersion::Fix } } #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(default)] struct CargoManifest { package: Option<CargoPackage>, } impl CargoManifest { fn into_config(self) -> Option<Config> { self.package.and_then(|p| p.into_config()) } } #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(default)] struct CargoPackage { include: Option<Vec<String>>, exclude: Option<Vec<String>>, metadata: Option<CargoMetadata>, } impl CargoPackage { fn into_config(self) -> Option<Config> { if self.include.is_none() && self.exclude.is_none() && self.metadata.is_none() { return None; } let CargoPackage { include, exclude, metadata, } = self; let mut config = metadata.and_then(|m| m.release).unwrap_or_default(); if config.exclude_paths.is_none() { if let Some(_include) = include { log::trace!("Ignoring `include` from Cargo.toml"); } else if let Some(exclude) = exclude { config.exclude_paths = Some(exclude); } } Some(config) } } #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(default)] struct CargoMetadata { release: Option<Config>, } fn load_from_file(path: &Path) -> io::Result<String> { let mut file = File::open(path)?; let mut s = String::new(); file.read_to_string(&mut s)?; Ok(s) } fn get_config_from_manifest(manifest_path: &Path) -> Result<Option<Config>, FatalError> { if manifest_path.exists() { let m = load_from_file(manifest_path).map_err(FatalError::from)?; let c: CargoManifest = toml::from_str(&m).map_err(FatalError::from)?; Ok(c.into_config()) } else { Ok(None) } } fn get_config_from_file(file_path: &Path) -> Result<Option<Config>, FatalError> { if file_path.exists() { let c = load_from_file(file_path).map_err(FatalError::from)?; let config = toml::from_str(&c).map_err(FatalError::from)?; Ok(Some(config)) } else { Ok(None) } } pub fn resolve_custom_config(file_path: &Path) -> Result<Option<Config>, FatalError> { get_config_from_file(file_path) } /// Try to resolve workspace configuration source. /// /// This tries the following sources in order, merging the results: /// 1. $HOME/.release.toml /// 2. $(workspace)/release.toml pub fn resolve_workspace_config(workspace_root: &Path) -> Result<Config, FatalError> { let mut config = Config::default(); // User-local configuration from home directory. let home_dir = dirs_next::home_dir(); if let Some(mut home) = home_dir { home.push(".release.toml"); if let Some(cfg) = get_config_from_file(&home)? { config.update(&cfg); } }; let default_config = workspace_root.join("release.toml"); let current_dir_config = get_config_from_file(&default_config)?; if let Some(cfg) = current_dir_config { config.update(&cfg); }; Ok(config) } /// Try to resolve configuration source. /// /// This tries the following sources in order, merging the results: /// 1. $HOME/.release.toml /// 2. $(workspace)/release.toml /// 4. $(crate)/release.toml /// 3. $(crate)/Cargo.toml `package.metadata.release` /// /// `$(crate)/Cargo.toml` is a way to differentiate configuration for the root crate and the /// workspace. pub fn resolve_config(workspace_root: &Path, manifest_path: &Path) -> Result<Config, FatalError> { let mut config = Config::default(); // User-local configuration from home directory. let home_dir = dirs_next::home_dir(); if let Some(mut home) = home_dir { home.push(".release.toml"); if let Some(cfg) = get_config_from_file(&home)? { config.update(&cfg); } }; let crate_root = manifest_path.parent().unwrap_or_else(|| Path::new(".")); if crate_root != workspace_root { let default_config = workspace_root.join("release.toml"); let current_dir_config = get_config_from_file(&default_config)?; if let Some(cfg) = current_dir_config { config.update(&cfg); }; } // Project release file. let default_config = crate_root.join("release.toml"); let current_dir_config = get_config_from_file(&default_config)?; if let Some(cfg) = current_dir_config { config.update(&cfg); }; // Crate manifest. let current_dir_config = get_config_from_manifest(manifest_path)?; if let Some(cfg) = current_dir_config { config.update(&cfg); }; Ok(config) } #[cfg(test)] mod test { use super::*; mod resolve_config { use super::*; #[test] fn doesnt_panic() { let release_config = resolve_config(Path::new("."), Path::new("Cargo.toml")).unwrap(); assert!(release_config.sign_commit()); } } }
//! Bindings to the HydraHarp400 library from PicoQuant #[macro_use] extern crate num_derive; use pyo3::prelude::*; use pyo3::wrap_pyfunction; pub mod bindings { include!(concat!(env!("OUT_DIR"), "/bindings.rs")); } pub mod device; pub mod measurement; pub mod types; #[cfg(feature = "pyo3")] pub mod python_wrapper; use crate::bindings::*; use crate::device::Device; use crate::types::HydraHarpError::*; use crate::types::convert_hydra_harp_result; /// Take a C function which returns an i32 error and return either Ok(type) or Err(ErrorCode) #[macro_export] macro_rules! error_enum_or_value { ($function:expr, $value:expr) => { match $function { 0 => Ok($value), x => match num::FromPrimitive::from_i32(x) { None => Err(UnknownError), Some(e) => Err(e), }, } }; } /// Get the version of the HydraHarp dll /// TODO: don't just return a string of the bytes pub fn get_library_version() -> String { let mut version = [0i8; 8]; unsafe { HH_GetLibraryVersion(version.as_mut_ptr()); } return format!("{:?}", version); } /// convert from a coincidence channel pair (c1, c2) into an index fn coincidence_channels_to_index(channels: (u8, u8)) -> usize { match channels { (0, 1) | (1, 0) => 0, (0, 2) | (2, 0) => 1, (0, 3) | (3, 0) => 2, (0, 4) | (4, 0) => 3, (0, 5) | (5, 0) => 4, (0, 6) | (6, 0) => 5, (0, 7) | (7, 0) => 6, (1, 2) | (2, 1) => 7, (1, 3) | (3, 1) => 8, (1, 4) | (4, 1) => 9, (1, 5) | (5, 1) => 10, (1, 6) | (6, 1) => 11, (1, 7) | (7, 1) => 12, (2, 3) | (3, 2) => 13, (2, 4) | (4, 2) => 14, (2, 5) | (5, 2) => 15, (2, 6) | (6, 2) => 16, (2, 7) | (7, 2) => 17, (3, 4) | (4, 3) => 18, (3, 5) | (5, 3) => 19, (3, 6) | (6, 3) => 20, (3, 7) | (7, 3) => 21, (4, 5) | (5, 4) => 22, (4, 6) | (6, 4) => 23, (4, 7) | (7, 4) => 24, (5, 6) | (6, 5) => 25, (5, 7) | (7, 5) => 26, (6, 7) | (7, 6) => 27, _ => 28, } } fn index_to_coincidence_channels(index: usize) -> (u8, u8) { match index { 0 => (0, 1), 1 => (0, 2), 2 => (0, 3), 3 => (0, 4), 4 => (0, 5), 5 => (0, 6), 6 => (0, 7), 7 => (1, 2), 8 => (1, 3), 9 => (1, 4), 10 => (1, 5), 11 => (1, 6), 12 => (1, 7), 13 => (2, 3), 14 => (2, 4), 15 => (2, 5), 16 => (2, 6), 17 => (2, 7), 18 => (3, 4), 19 => (3, 5), 20 => (3, 6), 21 => (3, 7), 22 => (4, 5), 23 => (4, 6), 24 => (4, 7), 25 => (5, 6), 26 => (5, 7), 27 => (6, 7), _ => (255, 255), } } /// Sort out a vector of channels and times into an array of singles and an array of coincidences /// THE SLICE INPUT SHOULD BE SORTED pub fn singles_and_two_way_coincidences(coincidence_window: u64, times: &[(u8, u64)]) -> ([u64; 8], [u64; 29]) { use std::cmp::{min, max}; let mut singles = [0; 8]; let mut coincidences = [0; 29]; for (i, (c1, t1)) in times.iter().enumerate() { singles[*c1 as usize] += 1; for (c2, t2) in times.iter().skip(i + 1) { if c1 != c2 { if t2 < t1 { println!("{}, {}", t1, t2); } if max(t1, t2) - min(t1, t2) < coincidence_window { coincidences[coincidence_channels_to_index((*c1, *c2))] += 1; } else { break; } } } } (singles, coincidences) } #[cfg(test)] mod tests { use super::bindings::*; #[test] fn it_works() { let devs = (0..2i32) .map(|x| crate::device::Device::open_device(x)) .collect::<Vec<_>>(); assert_eq!( devs, (0..1i32) .map(|_| Err::<crate::device::Device, _>( crate::types::HydraHarpError::UnknownError )) .collect::<Vec<_>>() ); } #[test] fn get_library_version_works() { assert_eq!(crate::get_library_version(), String::new()) } }
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailDataProviderConnection(pub ::windows::core::IInspectable); impl EmailDataProviderConnection { #[cfg(feature = "Foundation")] pub fn MailboxSyncRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxSyncManagerSyncRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveMailboxSyncRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn DownloadMessageRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxDownloadMessageRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveDownloadMessageRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn DownloadAttachmentRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxDownloadAttachmentRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveDownloadAttachmentRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn CreateFolderRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxCreateFolderRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveCreateFolderRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn DeleteFolderRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxDeleteFolderRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveDeleteFolderRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn EmptyFolderRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxEmptyFolderRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveEmptyFolderRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn MoveFolderRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxMoveFolderRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveMoveFolderRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).19)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn UpdateMeetingResponseRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxUpdateMeetingResponseRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).20)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveUpdateMeetingResponseRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).21)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn ForwardMeetingRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxForwardMeetingRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).22)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveForwardMeetingRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).23)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn ProposeNewTimeForMeetingRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxProposeNewTimeForMeetingRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).24)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveProposeNewTimeForMeetingRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).25)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn SetAutoReplySettingsRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxSetAutoReplySettingsRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).26)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveSetAutoReplySettingsRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).27)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn GetAutoReplySettingsRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxGetAutoReplySettingsRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).28)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveGetAutoReplySettingsRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).29)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn ResolveRecipientsRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxResolveRecipientsRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).30)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveResolveRecipientsRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).31)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn ValidateCertificatesRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxValidateCertificatesRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).32)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveValidateCertificatesRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).33)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn ServerSearchReadBatchRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::TypedEventHandler<EmailDataProviderConnection, EmailMailboxServerSearchReadBatchRequestEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).34)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveServerSearchReadBatchRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).35)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } pub fn Start(&self) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).36)(::core::mem::transmute_copy(this)).ok() } } } unsafe impl ::windows::core::RuntimeType for EmailDataProviderConnection { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailDataProviderConnection;{3b9c9dc7-37b2-4bf0-ae30-7b644a1c96e1})"); } unsafe impl ::windows::core::Interface for EmailDataProviderConnection { type Vtable = IEmailDataProviderConnection_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3b9c9dc7_37b2_4bf0_ae30_7b644a1c96e1); } impl ::windows::core::RuntimeName for EmailDataProviderConnection { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailDataProviderConnection"; } impl ::core::convert::From<EmailDataProviderConnection> for ::windows::core::IUnknown { fn from(value: EmailDataProviderConnection) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailDataProviderConnection> for ::windows::core::IUnknown { fn from(value: &EmailDataProviderConnection) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailDataProviderConnection { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailDataProviderConnection { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailDataProviderConnection> for ::windows::core::IInspectable { fn from(value: EmailDataProviderConnection) -> Self { value.0 } } impl ::core::convert::From<&EmailDataProviderConnection> for ::windows::core::IInspectable { fn from(value: &EmailDataProviderConnection) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailDataProviderConnection { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailDataProviderConnection { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailDataProviderConnection {} unsafe impl ::core::marker::Sync for EmailDataProviderConnection {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailDataProviderTriggerDetails(pub ::windows::core::IInspectable); impl EmailDataProviderTriggerDetails { pub fn Connection(&self) -> ::windows::core::Result<EmailDataProviderConnection> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailDataProviderConnection>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailDataProviderTriggerDetails { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailDataProviderTriggerDetails;{8f3e4e50-341e-45f3-bba0-84a005e1319a})"); } unsafe impl ::windows::core::Interface for EmailDataProviderTriggerDetails { type Vtable = IEmailDataProviderTriggerDetails_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8f3e4e50_341e_45f3_bba0_84a005e1319a); } impl ::windows::core::RuntimeName for EmailDataProviderTriggerDetails { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailDataProviderTriggerDetails"; } impl ::core::convert::From<EmailDataProviderTriggerDetails> for ::windows::core::IUnknown { fn from(value: EmailDataProviderTriggerDetails) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailDataProviderTriggerDetails> for ::windows::core::IUnknown { fn from(value: &EmailDataProviderTriggerDetails) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailDataProviderTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailDataProviderTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailDataProviderTriggerDetails> for ::windows::core::IInspectable { fn from(value: EmailDataProviderTriggerDetails) -> Self { value.0 } } impl ::core::convert::From<&EmailDataProviderTriggerDetails> for ::windows::core::IInspectable { fn from(value: &EmailDataProviderTriggerDetails) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailDataProviderTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailDataProviderTriggerDetails { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailDataProviderTriggerDetails {} unsafe impl ::core::marker::Sync for EmailDataProviderTriggerDetails {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxCreateFolderRequest(pub ::windows::core::IInspectable); impl EmailMailboxCreateFolderRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn ParentFolderId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportCompletedAsync<'a, Param0: ::windows::core::IntoParam<'a, super::EmailFolder>>(&self, folder: Param0) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), folder.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self, status: super::EmailMailboxCreateFolderStatus) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), status, &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxCreateFolderRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxCreateFolderRequest;{184d3775-c921-4c39-a309-e16c9f22b04b})"); } unsafe impl ::windows::core::Interface for EmailMailboxCreateFolderRequest { type Vtable = IEmailMailboxCreateFolderRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x184d3775_c921_4c39_a309_e16c9f22b04b); } impl ::windows::core::RuntimeName for EmailMailboxCreateFolderRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxCreateFolderRequest"; } impl ::core::convert::From<EmailMailboxCreateFolderRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxCreateFolderRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxCreateFolderRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxCreateFolderRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxCreateFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxCreateFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxCreateFolderRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxCreateFolderRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxCreateFolderRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxCreateFolderRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxCreateFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxCreateFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxCreateFolderRequest {} unsafe impl ::core::marker::Sync for EmailMailboxCreateFolderRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxCreateFolderRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxCreateFolderRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxCreateFolderRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxCreateFolderRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxCreateFolderRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxCreateFolderRequestEventArgs;{03e4c02c-241c-4ea9-a68f-ff20bc5afc85})"); } unsafe impl ::windows::core::Interface for EmailMailboxCreateFolderRequestEventArgs { type Vtable = IEmailMailboxCreateFolderRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x03e4c02c_241c_4ea9_a68f_ff20bc5afc85); } impl ::windows::core::RuntimeName for EmailMailboxCreateFolderRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxCreateFolderRequestEventArgs"; } impl ::core::convert::From<EmailMailboxCreateFolderRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxCreateFolderRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxCreateFolderRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxCreateFolderRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxCreateFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxCreateFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxCreateFolderRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxCreateFolderRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxCreateFolderRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxCreateFolderRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxCreateFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxCreateFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxCreateFolderRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxCreateFolderRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxDeleteFolderRequest(pub ::windows::core::IInspectable); impl EmailMailboxDeleteFolderRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn EmailFolderId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportCompletedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self, status: super::EmailMailboxDeleteFolderStatus) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), status, &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxDeleteFolderRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxDeleteFolderRequest;{9469e88a-a931-4779-923d-09a3ea292e29})"); } unsafe impl ::windows::core::Interface for EmailMailboxDeleteFolderRequest { type Vtable = IEmailMailboxDeleteFolderRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9469e88a_a931_4779_923d_09a3ea292e29); } impl ::windows::core::RuntimeName for EmailMailboxDeleteFolderRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxDeleteFolderRequest"; } impl ::core::convert::From<EmailMailboxDeleteFolderRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxDeleteFolderRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxDeleteFolderRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxDeleteFolderRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxDeleteFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxDeleteFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxDeleteFolderRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxDeleteFolderRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxDeleteFolderRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxDeleteFolderRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxDeleteFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxDeleteFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxDeleteFolderRequest {} unsafe impl ::core::marker::Sync for EmailMailboxDeleteFolderRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxDeleteFolderRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxDeleteFolderRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxDeleteFolderRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxDeleteFolderRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxDeleteFolderRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxDeleteFolderRequestEventArgs;{b4d32d06-2332-4678-8378-28b579336846})"); } unsafe impl ::windows::core::Interface for EmailMailboxDeleteFolderRequestEventArgs { type Vtable = IEmailMailboxDeleteFolderRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb4d32d06_2332_4678_8378_28b579336846); } impl ::windows::core::RuntimeName for EmailMailboxDeleteFolderRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxDeleteFolderRequestEventArgs"; } impl ::core::convert::From<EmailMailboxDeleteFolderRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxDeleteFolderRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxDeleteFolderRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxDeleteFolderRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxDeleteFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxDeleteFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxDeleteFolderRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxDeleteFolderRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxDeleteFolderRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxDeleteFolderRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxDeleteFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxDeleteFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxDeleteFolderRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxDeleteFolderRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxDownloadAttachmentRequest(pub ::windows::core::IInspectable); impl EmailMailboxDownloadAttachmentRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn EmailMessageId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn EmailAttachmentId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportCompletedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxDownloadAttachmentRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxDownloadAttachmentRequest;{0b1dbbb4-750c-48e1-bce4-8d589684ffbc})"); } unsafe impl ::windows::core::Interface for EmailMailboxDownloadAttachmentRequest { type Vtable = IEmailMailboxDownloadAttachmentRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0b1dbbb4_750c_48e1_bce4_8d589684ffbc); } impl ::windows::core::RuntimeName for EmailMailboxDownloadAttachmentRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxDownloadAttachmentRequest"; } impl ::core::convert::From<EmailMailboxDownloadAttachmentRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxDownloadAttachmentRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxDownloadAttachmentRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxDownloadAttachmentRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxDownloadAttachmentRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxDownloadAttachmentRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxDownloadAttachmentRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxDownloadAttachmentRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxDownloadAttachmentRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxDownloadAttachmentRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxDownloadAttachmentRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxDownloadAttachmentRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxDownloadAttachmentRequest {} unsafe impl ::core::marker::Sync for EmailMailboxDownloadAttachmentRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxDownloadAttachmentRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxDownloadAttachmentRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxDownloadAttachmentRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxDownloadAttachmentRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxDownloadAttachmentRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxDownloadAttachmentRequestEventArgs;{ccddc46d-ffa8-4877-9f9d-fed7bcaf4104})"); } unsafe impl ::windows::core::Interface for EmailMailboxDownloadAttachmentRequestEventArgs { type Vtable = IEmailMailboxDownloadAttachmentRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xccddc46d_ffa8_4877_9f9d_fed7bcaf4104); } impl ::windows::core::RuntimeName for EmailMailboxDownloadAttachmentRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxDownloadAttachmentRequestEventArgs"; } impl ::core::convert::From<EmailMailboxDownloadAttachmentRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxDownloadAttachmentRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxDownloadAttachmentRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxDownloadAttachmentRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxDownloadAttachmentRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxDownloadAttachmentRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxDownloadAttachmentRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxDownloadAttachmentRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxDownloadAttachmentRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxDownloadAttachmentRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxDownloadAttachmentRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxDownloadAttachmentRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxDownloadAttachmentRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxDownloadAttachmentRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxDownloadMessageRequest(pub ::windows::core::IInspectable); impl EmailMailboxDownloadMessageRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn EmailMessageId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportCompletedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxDownloadMessageRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxDownloadMessageRequest;{497b4187-5b4d-4b23-816c-f3842beb753e})"); } unsafe impl ::windows::core::Interface for EmailMailboxDownloadMessageRequest { type Vtable = IEmailMailboxDownloadMessageRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x497b4187_5b4d_4b23_816c_f3842beb753e); } impl ::windows::core::RuntimeName for EmailMailboxDownloadMessageRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxDownloadMessageRequest"; } impl ::core::convert::From<EmailMailboxDownloadMessageRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxDownloadMessageRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxDownloadMessageRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxDownloadMessageRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxDownloadMessageRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxDownloadMessageRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxDownloadMessageRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxDownloadMessageRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxDownloadMessageRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxDownloadMessageRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxDownloadMessageRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxDownloadMessageRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxDownloadMessageRequest {} unsafe impl ::core::marker::Sync for EmailMailboxDownloadMessageRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxDownloadMessageRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxDownloadMessageRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxDownloadMessageRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxDownloadMessageRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxDownloadMessageRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxDownloadMessageRequestEventArgs;{470409ad-d0a0-4a5b-bb2a-37621039c53e})"); } unsafe impl ::windows::core::Interface for EmailMailboxDownloadMessageRequestEventArgs { type Vtable = IEmailMailboxDownloadMessageRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x470409ad_d0a0_4a5b_bb2a_37621039c53e); } impl ::windows::core::RuntimeName for EmailMailboxDownloadMessageRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxDownloadMessageRequestEventArgs"; } impl ::core::convert::From<EmailMailboxDownloadMessageRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxDownloadMessageRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxDownloadMessageRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxDownloadMessageRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxDownloadMessageRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxDownloadMessageRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxDownloadMessageRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxDownloadMessageRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxDownloadMessageRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxDownloadMessageRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxDownloadMessageRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxDownloadMessageRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxDownloadMessageRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxDownloadMessageRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxEmptyFolderRequest(pub ::windows::core::IInspectable); impl EmailMailboxEmptyFolderRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn EmailFolderId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportCompletedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self, status: super::EmailMailboxEmptyFolderStatus) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), status, &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxEmptyFolderRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxEmptyFolderRequest;{fe4b03ab-f86d-46d9-b4ce-bc8a6d9e9268})"); } unsafe impl ::windows::core::Interface for EmailMailboxEmptyFolderRequest { type Vtable = IEmailMailboxEmptyFolderRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfe4b03ab_f86d_46d9_b4ce_bc8a6d9e9268); } impl ::windows::core::RuntimeName for EmailMailboxEmptyFolderRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxEmptyFolderRequest"; } impl ::core::convert::From<EmailMailboxEmptyFolderRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxEmptyFolderRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxEmptyFolderRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxEmptyFolderRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxEmptyFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxEmptyFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxEmptyFolderRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxEmptyFolderRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxEmptyFolderRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxEmptyFolderRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxEmptyFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxEmptyFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxEmptyFolderRequest {} unsafe impl ::core::marker::Sync for EmailMailboxEmptyFolderRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxEmptyFolderRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxEmptyFolderRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxEmptyFolderRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxEmptyFolderRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxEmptyFolderRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxEmptyFolderRequestEventArgs;{7183f484-985a-4ac0-b33f-ee0e2627a3c0})"); } unsafe impl ::windows::core::Interface for EmailMailboxEmptyFolderRequestEventArgs { type Vtable = IEmailMailboxEmptyFolderRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7183f484_985a_4ac0_b33f_ee0e2627a3c0); } impl ::windows::core::RuntimeName for EmailMailboxEmptyFolderRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxEmptyFolderRequestEventArgs"; } impl ::core::convert::From<EmailMailboxEmptyFolderRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxEmptyFolderRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxEmptyFolderRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxEmptyFolderRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxEmptyFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxEmptyFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxEmptyFolderRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxEmptyFolderRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxEmptyFolderRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxEmptyFolderRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxEmptyFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxEmptyFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxEmptyFolderRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxEmptyFolderRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxForwardMeetingRequest(pub ::windows::core::IInspectable); impl EmailMailboxForwardMeetingRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn EmailMessageId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Recipients(&self) -> ::windows::core::Result<super::super::super::Foundation::Collections::IVectorView<super::EmailRecipient>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Collections::IVectorView<super::EmailRecipient>>(result__) } } pub fn Subject(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn ForwardHeaderType(&self) -> ::windows::core::Result<super::EmailMessageBodyKind> { let this = self; unsafe { let mut result__: super::EmailMessageBodyKind = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::EmailMessageBodyKind>(result__) } } pub fn ForwardHeader(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn Comment(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportCompletedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxForwardMeetingRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxForwardMeetingRequest;{616d6af1-70d4-4832-b869-b80542ae9be8})"); } unsafe impl ::windows::core::Interface for EmailMailboxForwardMeetingRequest { type Vtable = IEmailMailboxForwardMeetingRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x616d6af1_70d4_4832_b869_b80542ae9be8); } impl ::windows::core::RuntimeName for EmailMailboxForwardMeetingRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxForwardMeetingRequest"; } impl ::core::convert::From<EmailMailboxForwardMeetingRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxForwardMeetingRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxForwardMeetingRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxForwardMeetingRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxForwardMeetingRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxForwardMeetingRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxForwardMeetingRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxForwardMeetingRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxForwardMeetingRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxForwardMeetingRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxForwardMeetingRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxForwardMeetingRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxForwardMeetingRequest {} unsafe impl ::core::marker::Sync for EmailMailboxForwardMeetingRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxForwardMeetingRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxForwardMeetingRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxForwardMeetingRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxForwardMeetingRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxForwardMeetingRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxForwardMeetingRequestEventArgs;{2bd8f33a-2974-4759-a5a5-58f44d3c0275})"); } unsafe impl ::windows::core::Interface for EmailMailboxForwardMeetingRequestEventArgs { type Vtable = IEmailMailboxForwardMeetingRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2bd8f33a_2974_4759_a5a5_58f44d3c0275); } impl ::windows::core::RuntimeName for EmailMailboxForwardMeetingRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxForwardMeetingRequestEventArgs"; } impl ::core::convert::From<EmailMailboxForwardMeetingRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxForwardMeetingRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxForwardMeetingRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxForwardMeetingRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxForwardMeetingRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxForwardMeetingRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxForwardMeetingRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxForwardMeetingRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxForwardMeetingRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxForwardMeetingRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxForwardMeetingRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxForwardMeetingRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxForwardMeetingRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxForwardMeetingRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxGetAutoReplySettingsRequest(pub ::windows::core::IInspectable); impl EmailMailboxGetAutoReplySettingsRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn RequestedFormat(&self) -> ::windows::core::Result<super::EmailMailboxAutoReplyMessageResponseKind> { let this = self; unsafe { let mut result__: super::EmailMailboxAutoReplyMessageResponseKind = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::EmailMailboxAutoReplyMessageResponseKind>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportCompletedAsync<'a, Param0: ::windows::core::IntoParam<'a, super::EmailMailboxAutoReplySettings>>(&self, autoreplysettings: Param0) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), autoreplysettings.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxGetAutoReplySettingsRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxGetAutoReplySettingsRequest;{9b380789-1e88-4e01-84cc-1386ad9a2c2f})"); } unsafe impl ::windows::core::Interface for EmailMailboxGetAutoReplySettingsRequest { type Vtable = IEmailMailboxGetAutoReplySettingsRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9b380789_1e88_4e01_84cc_1386ad9a2c2f); } impl ::windows::core::RuntimeName for EmailMailboxGetAutoReplySettingsRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxGetAutoReplySettingsRequest"; } impl ::core::convert::From<EmailMailboxGetAutoReplySettingsRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxGetAutoReplySettingsRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxGetAutoReplySettingsRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxGetAutoReplySettingsRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxGetAutoReplySettingsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxGetAutoReplySettingsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxGetAutoReplySettingsRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxGetAutoReplySettingsRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxGetAutoReplySettingsRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxGetAutoReplySettingsRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxGetAutoReplySettingsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxGetAutoReplySettingsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxGetAutoReplySettingsRequest {} unsafe impl ::core::marker::Sync for EmailMailboxGetAutoReplySettingsRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxGetAutoReplySettingsRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxGetAutoReplySettingsRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxGetAutoReplySettingsRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxGetAutoReplySettingsRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxGetAutoReplySettingsRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxGetAutoReplySettingsRequestEventArgs;{d79f55c2-fd45-4004-8a91-9bacf38b7022})"); } unsafe impl ::windows::core::Interface for EmailMailboxGetAutoReplySettingsRequestEventArgs { type Vtable = IEmailMailboxGetAutoReplySettingsRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd79f55c2_fd45_4004_8a91_9bacf38b7022); } impl ::windows::core::RuntimeName for EmailMailboxGetAutoReplySettingsRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxGetAutoReplySettingsRequestEventArgs"; } impl ::core::convert::From<EmailMailboxGetAutoReplySettingsRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxGetAutoReplySettingsRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxGetAutoReplySettingsRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxGetAutoReplySettingsRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxGetAutoReplySettingsRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxGetAutoReplySettingsRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxGetAutoReplySettingsRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxGetAutoReplySettingsRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxGetAutoReplySettingsRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxGetAutoReplySettingsRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxGetAutoReplySettingsRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxGetAutoReplySettingsRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxGetAutoReplySettingsRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxGetAutoReplySettingsRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxMoveFolderRequest(pub ::windows::core::IInspectable); impl EmailMailboxMoveFolderRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn EmailFolderId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn NewParentFolderId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn NewFolderName(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportCompletedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxMoveFolderRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxMoveFolderRequest;{10ba2856-4a95-4068-91cc-67cc7acf454f})"); } unsafe impl ::windows::core::Interface for EmailMailboxMoveFolderRequest { type Vtable = IEmailMailboxMoveFolderRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x10ba2856_4a95_4068_91cc_67cc7acf454f); } impl ::windows::core::RuntimeName for EmailMailboxMoveFolderRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxMoveFolderRequest"; } impl ::core::convert::From<EmailMailboxMoveFolderRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxMoveFolderRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxMoveFolderRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxMoveFolderRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxMoveFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxMoveFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxMoveFolderRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxMoveFolderRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxMoveFolderRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxMoveFolderRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxMoveFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxMoveFolderRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxMoveFolderRequest {} unsafe impl ::core::marker::Sync for EmailMailboxMoveFolderRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxMoveFolderRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxMoveFolderRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxMoveFolderRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxMoveFolderRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxMoveFolderRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxMoveFolderRequestEventArgs;{38623020-14ba-4c88-8698-7239e3c8aaa7})"); } unsafe impl ::windows::core::Interface for EmailMailboxMoveFolderRequestEventArgs { type Vtable = IEmailMailboxMoveFolderRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x38623020_14ba_4c88_8698_7239e3c8aaa7); } impl ::windows::core::RuntimeName for EmailMailboxMoveFolderRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxMoveFolderRequestEventArgs"; } impl ::core::convert::From<EmailMailboxMoveFolderRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxMoveFolderRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxMoveFolderRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxMoveFolderRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxMoveFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxMoveFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxMoveFolderRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxMoveFolderRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxMoveFolderRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxMoveFolderRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxMoveFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxMoveFolderRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxMoveFolderRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxMoveFolderRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxProposeNewTimeForMeetingRequest(pub ::windows::core::IInspectable); impl EmailMailboxProposeNewTimeForMeetingRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn EmailMessageId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn NewStartTime(&self) -> ::windows::core::Result<super::super::super::Foundation::DateTime> { let this = self; unsafe { let mut result__: super::super::super::Foundation::DateTime = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::DateTime>(result__) } } #[cfg(feature = "Foundation")] pub fn NewDuration(&self) -> ::windows::core::Result<super::super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::TimeSpan>(result__) } } pub fn Subject(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn Comment(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportCompletedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxProposeNewTimeForMeetingRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxProposeNewTimeForMeetingRequest;{5aeff152-9799-4f9f-a399-ff07f3eef04e})"); } unsafe impl ::windows::core::Interface for EmailMailboxProposeNewTimeForMeetingRequest { type Vtable = IEmailMailboxProposeNewTimeForMeetingRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5aeff152_9799_4f9f_a399_ff07f3eef04e); } impl ::windows::core::RuntimeName for EmailMailboxProposeNewTimeForMeetingRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxProposeNewTimeForMeetingRequest"; } impl ::core::convert::From<EmailMailboxProposeNewTimeForMeetingRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxProposeNewTimeForMeetingRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxProposeNewTimeForMeetingRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxProposeNewTimeForMeetingRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxProposeNewTimeForMeetingRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxProposeNewTimeForMeetingRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxProposeNewTimeForMeetingRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxProposeNewTimeForMeetingRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxProposeNewTimeForMeetingRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxProposeNewTimeForMeetingRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxProposeNewTimeForMeetingRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxProposeNewTimeForMeetingRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxProposeNewTimeForMeetingRequest {} unsafe impl ::core::marker::Sync for EmailMailboxProposeNewTimeForMeetingRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxProposeNewTimeForMeetingRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxProposeNewTimeForMeetingRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxProposeNewTimeForMeetingRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxProposeNewTimeForMeetingRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxProposeNewTimeForMeetingRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxProposeNewTimeForMeetingRequestEventArgs;{fb480b98-33ad-4a67-8251-0f9c249b6a20})"); } unsafe impl ::windows::core::Interface for EmailMailboxProposeNewTimeForMeetingRequestEventArgs { type Vtable = IEmailMailboxProposeNewTimeForMeetingRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfb480b98_33ad_4a67_8251_0f9c249b6a20); } impl ::windows::core::RuntimeName for EmailMailboxProposeNewTimeForMeetingRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxProposeNewTimeForMeetingRequestEventArgs"; } impl ::core::convert::From<EmailMailboxProposeNewTimeForMeetingRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxProposeNewTimeForMeetingRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxProposeNewTimeForMeetingRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxProposeNewTimeForMeetingRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxProposeNewTimeForMeetingRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxProposeNewTimeForMeetingRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxProposeNewTimeForMeetingRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxProposeNewTimeForMeetingRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxProposeNewTimeForMeetingRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxProposeNewTimeForMeetingRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxProposeNewTimeForMeetingRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxProposeNewTimeForMeetingRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxProposeNewTimeForMeetingRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxProposeNewTimeForMeetingRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxResolveRecipientsRequest(pub ::windows::core::IInspectable); impl EmailMailboxResolveRecipientsRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Recipients(&self) -> ::windows::core::Result<super::super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>>(result__) } } #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub fn ReportCompletedAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::Collections::IIterable<super::EmailRecipientResolutionResult>>>(&self, resolutionresults: Param0) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), resolutionresults.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxResolveRecipientsRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxResolveRecipientsRequest;{efa4cf70-7b39-4c9b-811e-41eaf43a332d})"); } unsafe impl ::windows::core::Interface for EmailMailboxResolveRecipientsRequest { type Vtable = IEmailMailboxResolveRecipientsRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xefa4cf70_7b39_4c9b_811e_41eaf43a332d); } impl ::windows::core::RuntimeName for EmailMailboxResolveRecipientsRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxResolveRecipientsRequest"; } impl ::core::convert::From<EmailMailboxResolveRecipientsRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxResolveRecipientsRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxResolveRecipientsRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxResolveRecipientsRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxResolveRecipientsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxResolveRecipientsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxResolveRecipientsRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxResolveRecipientsRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxResolveRecipientsRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxResolveRecipientsRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxResolveRecipientsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxResolveRecipientsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxResolveRecipientsRequest {} unsafe impl ::core::marker::Sync for EmailMailboxResolveRecipientsRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxResolveRecipientsRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxResolveRecipientsRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxResolveRecipientsRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxResolveRecipientsRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxResolveRecipientsRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxResolveRecipientsRequestEventArgs;{260f9e02-b2cf-40f8-8c28-e3ed43b1e89a})"); } unsafe impl ::windows::core::Interface for EmailMailboxResolveRecipientsRequestEventArgs { type Vtable = IEmailMailboxResolveRecipientsRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x260f9e02_b2cf_40f8_8c28_e3ed43b1e89a); } impl ::windows::core::RuntimeName for EmailMailboxResolveRecipientsRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxResolveRecipientsRequestEventArgs"; } impl ::core::convert::From<EmailMailboxResolveRecipientsRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxResolveRecipientsRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxResolveRecipientsRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxResolveRecipientsRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxResolveRecipientsRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxResolveRecipientsRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxResolveRecipientsRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxResolveRecipientsRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxResolveRecipientsRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxResolveRecipientsRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxResolveRecipientsRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxResolveRecipientsRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxResolveRecipientsRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxResolveRecipientsRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxServerSearchReadBatchRequest(pub ::windows::core::IInspectable); impl EmailMailboxServerSearchReadBatchRequest { pub fn SessionId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn EmailFolderId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn Options(&self) -> ::windows::core::Result<super::EmailQueryOptions> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::EmailQueryOptions>(result__) } } pub fn SuggestedBatchSize(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } #[cfg(feature = "Foundation")] pub fn SaveMessageAsync<'a, Param0: ::windows::core::IntoParam<'a, super::EmailMessage>>(&self, message: Param0) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), message.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportCompletedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self, batchstatus: super::EmailBatchStatus) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), batchstatus, &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxServerSearchReadBatchRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxServerSearchReadBatchRequest;{090eebdf-5a96-41d3-8ad8-34912f9aa60e})"); } unsafe impl ::windows::core::Interface for EmailMailboxServerSearchReadBatchRequest { type Vtable = IEmailMailboxServerSearchReadBatchRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x090eebdf_5a96_41d3_8ad8_34912f9aa60e); } impl ::windows::core::RuntimeName for EmailMailboxServerSearchReadBatchRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxServerSearchReadBatchRequest"; } impl ::core::convert::From<EmailMailboxServerSearchReadBatchRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxServerSearchReadBatchRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxServerSearchReadBatchRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxServerSearchReadBatchRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxServerSearchReadBatchRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxServerSearchReadBatchRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxServerSearchReadBatchRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxServerSearchReadBatchRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxServerSearchReadBatchRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxServerSearchReadBatchRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxServerSearchReadBatchRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxServerSearchReadBatchRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxServerSearchReadBatchRequest {} unsafe impl ::core::marker::Sync for EmailMailboxServerSearchReadBatchRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxServerSearchReadBatchRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxServerSearchReadBatchRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxServerSearchReadBatchRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxServerSearchReadBatchRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxServerSearchReadBatchRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxServerSearchReadBatchRequestEventArgs;{14101b4e-ed9e-45d1-ad7a-cc9b7f643ae2})"); } unsafe impl ::windows::core::Interface for EmailMailboxServerSearchReadBatchRequestEventArgs { type Vtable = IEmailMailboxServerSearchReadBatchRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x14101b4e_ed9e_45d1_ad7a_cc9b7f643ae2); } impl ::windows::core::RuntimeName for EmailMailboxServerSearchReadBatchRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxServerSearchReadBatchRequestEventArgs"; } impl ::core::convert::From<EmailMailboxServerSearchReadBatchRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxServerSearchReadBatchRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxServerSearchReadBatchRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxServerSearchReadBatchRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxServerSearchReadBatchRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxServerSearchReadBatchRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxServerSearchReadBatchRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxServerSearchReadBatchRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxServerSearchReadBatchRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxServerSearchReadBatchRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxServerSearchReadBatchRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxServerSearchReadBatchRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxServerSearchReadBatchRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxServerSearchReadBatchRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxSetAutoReplySettingsRequest(pub ::windows::core::IInspectable); impl EmailMailboxSetAutoReplySettingsRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn AutoReplySettings(&self) -> ::windows::core::Result<super::EmailMailboxAutoReplySettings> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::EmailMailboxAutoReplySettings>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportCompletedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxSetAutoReplySettingsRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxSetAutoReplySettingsRequest;{75a422d0-a88e-4e54-8dc7-c243186b774e})"); } unsafe impl ::windows::core::Interface for EmailMailboxSetAutoReplySettingsRequest { type Vtable = IEmailMailboxSetAutoReplySettingsRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x75a422d0_a88e_4e54_8dc7_c243186b774e); } impl ::windows::core::RuntimeName for EmailMailboxSetAutoReplySettingsRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxSetAutoReplySettingsRequest"; } impl ::core::convert::From<EmailMailboxSetAutoReplySettingsRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxSetAutoReplySettingsRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxSetAutoReplySettingsRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxSetAutoReplySettingsRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxSetAutoReplySettingsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxSetAutoReplySettingsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxSetAutoReplySettingsRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxSetAutoReplySettingsRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxSetAutoReplySettingsRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxSetAutoReplySettingsRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxSetAutoReplySettingsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxSetAutoReplySettingsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxSetAutoReplySettingsRequest {} unsafe impl ::core::marker::Sync for EmailMailboxSetAutoReplySettingsRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxSetAutoReplySettingsRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxSetAutoReplySettingsRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxSetAutoReplySettingsRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxSetAutoReplySettingsRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxSetAutoReplySettingsRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxSetAutoReplySettingsRequestEventArgs;{09da11ad-d7ca-4087-ac86-53fa67f76246})"); } unsafe impl ::windows::core::Interface for EmailMailboxSetAutoReplySettingsRequestEventArgs { type Vtable = IEmailMailboxSetAutoReplySettingsRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x09da11ad_d7ca_4087_ac86_53fa67f76246); } impl ::windows::core::RuntimeName for EmailMailboxSetAutoReplySettingsRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxSetAutoReplySettingsRequestEventArgs"; } impl ::core::convert::From<EmailMailboxSetAutoReplySettingsRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxSetAutoReplySettingsRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxSetAutoReplySettingsRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxSetAutoReplySettingsRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxSetAutoReplySettingsRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxSetAutoReplySettingsRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxSetAutoReplySettingsRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxSetAutoReplySettingsRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxSetAutoReplySettingsRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxSetAutoReplySettingsRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxSetAutoReplySettingsRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxSetAutoReplySettingsRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxSetAutoReplySettingsRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxSetAutoReplySettingsRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxSyncManagerSyncRequest(pub ::windows::core::IInspectable); impl EmailMailboxSyncManagerSyncRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportCompletedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxSyncManagerSyncRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxSyncManagerSyncRequest;{4e10e8e4-7e67-405a-b673-dc60c91090fc})"); } unsafe impl ::windows::core::Interface for EmailMailboxSyncManagerSyncRequest { type Vtable = IEmailMailboxSyncManagerSyncRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4e10e8e4_7e67_405a_b673_dc60c91090fc); } impl ::windows::core::RuntimeName for EmailMailboxSyncManagerSyncRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxSyncManagerSyncRequest"; } impl ::core::convert::From<EmailMailboxSyncManagerSyncRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxSyncManagerSyncRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxSyncManagerSyncRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxSyncManagerSyncRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxSyncManagerSyncRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxSyncManagerSyncRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxSyncManagerSyncRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxSyncManagerSyncRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxSyncManagerSyncRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxSyncManagerSyncRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxSyncManagerSyncRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxSyncManagerSyncRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxSyncManagerSyncRequest {} unsafe impl ::core::marker::Sync for EmailMailboxSyncManagerSyncRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxSyncManagerSyncRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxSyncManagerSyncRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxSyncManagerSyncRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxSyncManagerSyncRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxSyncManagerSyncRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxSyncManagerSyncRequestEventArgs;{439a031a-8fcc-4ae5-b9b5-d434e0a65aa8})"); } unsafe impl ::windows::core::Interface for EmailMailboxSyncManagerSyncRequestEventArgs { type Vtable = IEmailMailboxSyncManagerSyncRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x439a031a_8fcc_4ae5_b9b5_d434e0a65aa8); } impl ::windows::core::RuntimeName for EmailMailboxSyncManagerSyncRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxSyncManagerSyncRequestEventArgs"; } impl ::core::convert::From<EmailMailboxSyncManagerSyncRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxSyncManagerSyncRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxSyncManagerSyncRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxSyncManagerSyncRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxSyncManagerSyncRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxSyncManagerSyncRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxSyncManagerSyncRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxSyncManagerSyncRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxSyncManagerSyncRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxSyncManagerSyncRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxSyncManagerSyncRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxSyncManagerSyncRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxSyncManagerSyncRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxSyncManagerSyncRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxUpdateMeetingResponseRequest(pub ::windows::core::IInspectable); impl EmailMailboxUpdateMeetingResponseRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn EmailMessageId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn Response(&self) -> ::windows::core::Result<super::EmailMeetingResponseType> { let this = self; unsafe { let mut result__: super::EmailMeetingResponseType = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::EmailMeetingResponseType>(result__) } } pub fn Subject(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn Comment(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SendUpdate(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportCompletedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxUpdateMeetingResponseRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxUpdateMeetingResponseRequest;{5b99ac93-b2cf-4888-ba4f-306b6b66df30})"); } unsafe impl ::windows::core::Interface for EmailMailboxUpdateMeetingResponseRequest { type Vtable = IEmailMailboxUpdateMeetingResponseRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5b99ac93_b2cf_4888_ba4f_306b6b66df30); } impl ::windows::core::RuntimeName for EmailMailboxUpdateMeetingResponseRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxUpdateMeetingResponseRequest"; } impl ::core::convert::From<EmailMailboxUpdateMeetingResponseRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxUpdateMeetingResponseRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxUpdateMeetingResponseRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxUpdateMeetingResponseRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxUpdateMeetingResponseRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxUpdateMeetingResponseRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxUpdateMeetingResponseRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxUpdateMeetingResponseRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxUpdateMeetingResponseRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxUpdateMeetingResponseRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxUpdateMeetingResponseRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxUpdateMeetingResponseRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxUpdateMeetingResponseRequest {} unsafe impl ::core::marker::Sync for EmailMailboxUpdateMeetingResponseRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxUpdateMeetingResponseRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxUpdateMeetingResponseRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxUpdateMeetingResponseRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxUpdateMeetingResponseRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxUpdateMeetingResponseRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxUpdateMeetingResponseRequestEventArgs;{6898d761-56c9-4f17-be31-66fda94ba159})"); } unsafe impl ::windows::core::Interface for EmailMailboxUpdateMeetingResponseRequestEventArgs { type Vtable = IEmailMailboxUpdateMeetingResponseRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6898d761_56c9_4f17_be31_66fda94ba159); } impl ::windows::core::RuntimeName for EmailMailboxUpdateMeetingResponseRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxUpdateMeetingResponseRequestEventArgs"; } impl ::core::convert::From<EmailMailboxUpdateMeetingResponseRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxUpdateMeetingResponseRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxUpdateMeetingResponseRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxUpdateMeetingResponseRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxUpdateMeetingResponseRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxUpdateMeetingResponseRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxUpdateMeetingResponseRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxUpdateMeetingResponseRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxUpdateMeetingResponseRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxUpdateMeetingResponseRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxUpdateMeetingResponseRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxUpdateMeetingResponseRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxUpdateMeetingResponseRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxUpdateMeetingResponseRequestEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxValidateCertificatesRequest(pub ::windows::core::IInspectable); impl EmailMailboxValidateCertificatesRequest { pub fn EmailMailboxId(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = self; unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } #[cfg(all(feature = "Foundation_Collections", feature = "Security_Cryptography_Certificates"))] pub fn Certificates(&self) -> ::windows::core::Result<super::super::super::Foundation::Collections::IVectorView<super::super::super::Security::Cryptography::Certificates::Certificate>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Collections::IVectorView<super::super::super::Security::Cryptography::Certificates::Certificate>>(result__) } } #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub fn ReportCompletedAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::super::Foundation::Collections::IIterable<super::EmailCertificateValidationStatus>>>(&self, validationstatuses: Param0) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), validationstatuses.into_param().abi(), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Foundation")] pub fn ReportFailedAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::IAsyncAction>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxValidateCertificatesRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxValidateCertificatesRequest;{a94d3931-e11a-4f97-b81a-187a70a8f41a})"); } unsafe impl ::windows::core::Interface for EmailMailboxValidateCertificatesRequest { type Vtable = IEmailMailboxValidateCertificatesRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa94d3931_e11a_4f97_b81a_187a70a8f41a); } impl ::windows::core::RuntimeName for EmailMailboxValidateCertificatesRequest { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxValidateCertificatesRequest"; } impl ::core::convert::From<EmailMailboxValidateCertificatesRequest> for ::windows::core::IUnknown { fn from(value: EmailMailboxValidateCertificatesRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxValidateCertificatesRequest> for ::windows::core::IUnknown { fn from(value: &EmailMailboxValidateCertificatesRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxValidateCertificatesRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxValidateCertificatesRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxValidateCertificatesRequest> for ::windows::core::IInspectable { fn from(value: EmailMailboxValidateCertificatesRequest) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxValidateCertificatesRequest> for ::windows::core::IInspectable { fn from(value: &EmailMailboxValidateCertificatesRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxValidateCertificatesRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxValidateCertificatesRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxValidateCertificatesRequest {} unsafe impl ::core::marker::Sync for EmailMailboxValidateCertificatesRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EmailMailboxValidateCertificatesRequestEventArgs(pub ::windows::core::IInspectable); impl EmailMailboxValidateCertificatesRequestEventArgs { pub fn Request(&self) -> ::windows::core::Result<EmailMailboxValidateCertificatesRequest> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<EmailMailboxValidateCertificatesRequest>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::super::Foundation::Deferral> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::super::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for EmailMailboxValidateCertificatesRequestEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.ApplicationModel.Email.DataProvider.EmailMailboxValidateCertificatesRequestEventArgs;{2583bf17-02ff-49fe-a73c-03f37566c691})"); } unsafe impl ::windows::core::Interface for EmailMailboxValidateCertificatesRequestEventArgs { type Vtable = IEmailMailboxValidateCertificatesRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2583bf17_02ff_49fe_a73c_03f37566c691); } impl ::windows::core::RuntimeName for EmailMailboxValidateCertificatesRequestEventArgs { const NAME: &'static str = "Windows.ApplicationModel.Email.DataProvider.EmailMailboxValidateCertificatesRequestEventArgs"; } impl ::core::convert::From<EmailMailboxValidateCertificatesRequestEventArgs> for ::windows::core::IUnknown { fn from(value: EmailMailboxValidateCertificatesRequestEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&EmailMailboxValidateCertificatesRequestEventArgs> for ::windows::core::IUnknown { fn from(value: &EmailMailboxValidateCertificatesRequestEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for EmailMailboxValidateCertificatesRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a EmailMailboxValidateCertificatesRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<EmailMailboxValidateCertificatesRequestEventArgs> for ::windows::core::IInspectable { fn from(value: EmailMailboxValidateCertificatesRequestEventArgs) -> Self { value.0 } } impl ::core::convert::From<&EmailMailboxValidateCertificatesRequestEventArgs> for ::windows::core::IInspectable { fn from(value: &EmailMailboxValidateCertificatesRequestEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for EmailMailboxValidateCertificatesRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a EmailMailboxValidateCertificatesRequestEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for EmailMailboxValidateCertificatesRequestEventArgs {} unsafe impl ::core::marker::Sync for EmailMailboxValidateCertificatesRequestEventArgs {} #[repr(transparent)] #[doc(hidden)] pub struct IEmailDataProviderConnection(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailDataProviderConnection { type Vtable = IEmailDataProviderConnection_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3b9c9dc7_37b2_4bf0_ae30_7b644a1c96e1); } #[repr(C)] #[doc(hidden)] pub struct IEmailDataProviderConnection_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, token: super::super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailDataProviderTriggerDetails(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailDataProviderTriggerDetails { type Vtable = IEmailDataProviderTriggerDetails_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8f3e4e50_341e_45f3_bba0_84a005e1319a); } #[repr(C)] #[doc(hidden)] pub struct IEmailDataProviderTriggerDetails_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxCreateFolderRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxCreateFolderRequest { type Vtable = IEmailMailboxCreateFolderRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x184d3775_c921_4c39_a309_e16c9f22b04b); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxCreateFolderRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, folder: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, status: super::EmailMailboxCreateFolderStatus, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxCreateFolderRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxCreateFolderRequestEventArgs { type Vtable = IEmailMailboxCreateFolderRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x03e4c02c_241c_4ea9_a68f_ff20bc5afc85); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxCreateFolderRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxDeleteFolderRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxDeleteFolderRequest { type Vtable = IEmailMailboxDeleteFolderRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9469e88a_a931_4779_923d_09a3ea292e29); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxDeleteFolderRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, status: super::EmailMailboxDeleteFolderStatus, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxDeleteFolderRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxDeleteFolderRequestEventArgs { type Vtable = IEmailMailboxDeleteFolderRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb4d32d06_2332_4678_8378_28b579336846); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxDeleteFolderRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxDownloadAttachmentRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxDownloadAttachmentRequest { type Vtable = IEmailMailboxDownloadAttachmentRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0b1dbbb4_750c_48e1_bce4_8d589684ffbc); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxDownloadAttachmentRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxDownloadAttachmentRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxDownloadAttachmentRequestEventArgs { type Vtable = IEmailMailboxDownloadAttachmentRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xccddc46d_ffa8_4877_9f9d_fed7bcaf4104); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxDownloadAttachmentRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxDownloadMessageRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxDownloadMessageRequest { type Vtable = IEmailMailboxDownloadMessageRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x497b4187_5b4d_4b23_816c_f3842beb753e); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxDownloadMessageRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxDownloadMessageRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxDownloadMessageRequestEventArgs { type Vtable = IEmailMailboxDownloadMessageRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x470409ad_d0a0_4a5b_bb2a_37621039c53e); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxDownloadMessageRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxEmptyFolderRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxEmptyFolderRequest { type Vtable = IEmailMailboxEmptyFolderRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfe4b03ab_f86d_46d9_b4ce_bc8a6d9e9268); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxEmptyFolderRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, status: super::EmailMailboxEmptyFolderStatus, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxEmptyFolderRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxEmptyFolderRequestEventArgs { type Vtable = IEmailMailboxEmptyFolderRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7183f484_985a_4ac0_b33f_ee0e2627a3c0); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxEmptyFolderRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxForwardMeetingRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxForwardMeetingRequest { type Vtable = IEmailMailboxForwardMeetingRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x616d6af1_70d4_4832_b869_b80542ae9be8); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxForwardMeetingRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::EmailMessageBodyKind) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxForwardMeetingRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxForwardMeetingRequestEventArgs { type Vtable = IEmailMailboxForwardMeetingRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2bd8f33a_2974_4759_a5a5_58f44d3c0275); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxForwardMeetingRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxGetAutoReplySettingsRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxGetAutoReplySettingsRequest { type Vtable = IEmailMailboxGetAutoReplySettingsRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9b380789_1e88_4e01_84cc_1386ad9a2c2f); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxGetAutoReplySettingsRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::EmailMailboxAutoReplyMessageResponseKind) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, autoreplysettings: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxGetAutoReplySettingsRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxGetAutoReplySettingsRequestEventArgs { type Vtable = IEmailMailboxGetAutoReplySettingsRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd79f55c2_fd45_4004_8a91_9bacf38b7022); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxGetAutoReplySettingsRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxMoveFolderRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxMoveFolderRequest { type Vtable = IEmailMailboxMoveFolderRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x10ba2856_4a95_4068_91cc_67cc7acf454f); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxMoveFolderRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxMoveFolderRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxMoveFolderRequestEventArgs { type Vtable = IEmailMailboxMoveFolderRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x38623020_14ba_4c88_8698_7239e3c8aaa7); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxMoveFolderRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxProposeNewTimeForMeetingRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxProposeNewTimeForMeetingRequest { type Vtable = IEmailMailboxProposeNewTimeForMeetingRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5aeff152_9799_4f9f_a399_ff07f3eef04e); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxProposeNewTimeForMeetingRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::DateTime) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxProposeNewTimeForMeetingRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxProposeNewTimeForMeetingRequestEventArgs { type Vtable = IEmailMailboxProposeNewTimeForMeetingRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfb480b98_33ad_4a67_8251_0f9c249b6a20); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxProposeNewTimeForMeetingRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxResolveRecipientsRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxResolveRecipientsRequest { type Vtable = IEmailMailboxResolveRecipientsRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xefa4cf70_7b39_4c9b_811e_41eaf43a332d); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxResolveRecipientsRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, resolutionresults: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Foundation_Collections")))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxResolveRecipientsRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxResolveRecipientsRequestEventArgs { type Vtable = IEmailMailboxResolveRecipientsRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x260f9e02_b2cf_40f8_8c28_e3ed43b1e89a); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxResolveRecipientsRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxServerSearchReadBatchRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxServerSearchReadBatchRequest { type Vtable = IEmailMailboxServerSearchReadBatchRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x090eebdf_5a96_41d3_8ad8_34912f9aa60e); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxServerSearchReadBatchRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, message: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, batchstatus: super::EmailBatchStatus, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxServerSearchReadBatchRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxServerSearchReadBatchRequestEventArgs { type Vtable = IEmailMailboxServerSearchReadBatchRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x14101b4e_ed9e_45d1_ad7a_cc9b7f643ae2); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxServerSearchReadBatchRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxSetAutoReplySettingsRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxSetAutoReplySettingsRequest { type Vtable = IEmailMailboxSetAutoReplySettingsRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x75a422d0_a88e_4e54_8dc7_c243186b774e); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxSetAutoReplySettingsRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxSetAutoReplySettingsRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxSetAutoReplySettingsRequestEventArgs { type Vtable = IEmailMailboxSetAutoReplySettingsRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x09da11ad_d7ca_4087_ac86_53fa67f76246); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxSetAutoReplySettingsRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxSyncManagerSyncRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxSyncManagerSyncRequest { type Vtable = IEmailMailboxSyncManagerSyncRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4e10e8e4_7e67_405a_b673_dc60c91090fc); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxSyncManagerSyncRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxSyncManagerSyncRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxSyncManagerSyncRequestEventArgs { type Vtable = IEmailMailboxSyncManagerSyncRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x439a031a_8fcc_4ae5_b9b5_d434e0a65aa8); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxSyncManagerSyncRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxUpdateMeetingResponseRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxUpdateMeetingResponseRequest { type Vtable = IEmailMailboxUpdateMeetingResponseRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5b99ac93_b2cf_4888_ba4f_306b6b66df30); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxUpdateMeetingResponseRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::EmailMeetingResponseType) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxUpdateMeetingResponseRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxUpdateMeetingResponseRequestEventArgs { type Vtable = IEmailMailboxUpdateMeetingResponseRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6898d761_56c9_4f17_be31_66fda94ba159); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxUpdateMeetingResponseRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxValidateCertificatesRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxValidateCertificatesRequest { type Vtable = IEmailMailboxValidateCertificatesRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa94d3931_e11a_4f97_b81a_187a70a8f41a); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxValidateCertificatesRequest_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(all(feature = "Foundation_Collections", feature = "Security_Cryptography_Certificates"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation_Collections", feature = "Security_Cryptography_Certificates")))] usize, #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, validationstatuses: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Foundation_Collections")))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IEmailMailboxValidateCertificatesRequestEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IEmailMailboxValidateCertificatesRequestEventArgs { type Vtable = IEmailMailboxValidateCertificatesRequestEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2583bf17_02ff_49fe_a73c_03f37566c691); } #[repr(C)] #[doc(hidden)] pub struct IEmailMailboxValidateCertificatesRequestEventArgs_abi( pub unsafe extern "system" fn(this: ::windows::core::RawPtr, iid: &::windows::core::GUID, interface: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> u32, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, count: *mut u32, values: *mut *mut ::windows::core::GUID) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, );
extern crate num_complex; mod gamma; mod polynomials; mod ei; mod antiderivatives; pub mod sf{ pub use gamma::*; pub use polynomials::*; pub use ei::*; pub use antiderivatives::*; } pub mod nt; pub mod pc; #[allow(non_camel_case_types)] pub type c64 = num_complex::Complex<f64>; pub const TAU: f64 = 6.283185307179586; pub const GAMMA: f64 = 0.57721566490153286061;
pub struct Solution; impl Solution { pub fn restore_ip_addresses(s: String) -> Vec<String> { let mut res = Vec::new(); rec(&mut String::new(), &s, 4, &mut res); res } } fn rec(head: &mut String, s: &str, count: usize, res: &mut Vec<String>) { if s.is_empty() || count == 0 { if s.is_empty() && count == 0 { res.push(head.clone()); } return; } if s.len() < count || s.len() > 3 * count { return; } if count < 4 { head.push('.'); } head.push_str(&s[..1]); rec(head, &s[1..], count - 1, res); head.pop(); if s.len() >= 2 && &s[..1] != "0" { head.push_str(&s[..2]); rec(head, &s[2..], count - 1, res); head.pop(); head.pop(); } if s.len() >= 3 && &s[..1] != "0" && &s[..3] < "256" { head.push_str(&s[..3]); rec(head, &s[3..], count - 1, res); head.pop(); head.pop(); head.pop(); } if count < 4 { head.pop(); } } #[test] fn test0093() { assert_eq!( Solution::restore_ip_addresses("25525511135".to_string()), vec!["255.255.11.135", "255.255.111.35"] ); assert_eq!( Solution::restore_ip_addresses("0000".to_string()), vec!["0.0.0.0"] ); }
#[doc = "Reader of register BDMUPDR"] pub type R = crate::R<u32, super::BDMUPDR>; #[doc = "Writer for register BDMUPDR"] pub type W = crate::W<u32, super::BDMUPDR>; #[doc = "Register BDMUPDR `reset()`'s with value 0"] impl crate::ResetValue for super::BDMUPDR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `MCMP4`"] pub type MCMP4_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MCMP4`"] pub struct MCMP4_W<'a> { w: &'a mut W, } impl<'a> MCMP4_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9); self.w } } #[doc = "Reader of field `MCMP3`"] pub type MCMP3_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MCMP3`"] pub struct MCMP3_W<'a> { w: &'a mut W, } impl<'a> MCMP3_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8); self.w } } #[doc = "Reader of field `MCMP2`"] pub type MCMP2_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MCMP2`"] pub struct MCMP2_W<'a> { w: &'a mut W, } impl<'a> MCMP2_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7); self.w } } #[doc = "Reader of field `MCMP1`"] pub type MCMP1_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MCMP1`"] pub struct MCMP1_W<'a> { w: &'a mut W, } impl<'a> MCMP1_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u32) & 0x01) << 6); self.w } } #[doc = "Reader of field `MREP`"] pub type MREP_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MREP`"] pub struct MREP_W<'a> { w: &'a mut W, } impl<'a> MREP_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5); self.w } } #[doc = "Reader of field `MPER`"] pub type MPER_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MPER`"] pub struct MPER_W<'a> { w: &'a mut W, } impl<'a> MPER_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4); self.w } } #[doc = "Reader of field `MCNT`"] pub type MCNT_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MCNT`"] pub struct MCNT_W<'a> { w: &'a mut W, } impl<'a> MCNT_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u32) & 0x01) << 3); self.w } } #[doc = "Reader of field `MDIER`"] pub type MDIER_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MDIER`"] pub struct MDIER_W<'a> { w: &'a mut W, } impl<'a> MDIER_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2); self.w } } #[doc = "Reader of field `MICR`"] pub type MICR_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MICR`"] pub struct MICR_W<'a> { w: &'a mut W, } impl<'a> MICR_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1); self.w } } #[doc = "Reader of field `MCR`"] pub type MCR_R = crate::R<bool, bool>; #[doc = "Write proxy for field `MCR`"] pub struct MCR_W<'a> { w: &'a mut W, } impl<'a> MCR_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01); self.w } } impl R { #[doc = "Bit 9 - MCMP4"] #[inline(always)] pub fn mcmp4(&self) -> MCMP4_R { MCMP4_R::new(((self.bits >> 9) & 0x01) != 0) } #[doc = "Bit 8 - MCMP3"] #[inline(always)] pub fn mcmp3(&self) -> MCMP3_R { MCMP3_R::new(((self.bits >> 8) & 0x01) != 0) } #[doc = "Bit 7 - MCMP2"] #[inline(always)] pub fn mcmp2(&self) -> MCMP2_R { MCMP2_R::new(((self.bits >> 7) & 0x01) != 0) } #[doc = "Bit 6 - MCMP1"] #[inline(always)] pub fn mcmp1(&self) -> MCMP1_R { MCMP1_R::new(((self.bits >> 6) & 0x01) != 0) } #[doc = "Bit 5 - MREP"] #[inline(always)] pub fn mrep(&self) -> MREP_R { MREP_R::new(((self.bits >> 5) & 0x01) != 0) } #[doc = "Bit 4 - MPER"] #[inline(always)] pub fn mper(&self) -> MPER_R { MPER_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 3 - MCNT"] #[inline(always)] pub fn mcnt(&self) -> MCNT_R { MCNT_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 2 - MDIER"] #[inline(always)] pub fn mdier(&self) -> MDIER_R { MDIER_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 1 - MICR"] #[inline(always)] pub fn micr(&self) -> MICR_R { MICR_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 0 - MCR"] #[inline(always)] pub fn mcr(&self) -> MCR_R { MCR_R::new((self.bits & 0x01) != 0) } } impl W { #[doc = "Bit 9 - MCMP4"] #[inline(always)] pub fn mcmp4(&mut self) -> MCMP4_W { MCMP4_W { w: self } } #[doc = "Bit 8 - MCMP3"] #[inline(always)] pub fn mcmp3(&mut self) -> MCMP3_W { MCMP3_W { w: self } } #[doc = "Bit 7 - MCMP2"] #[inline(always)] pub fn mcmp2(&mut self) -> MCMP2_W { MCMP2_W { w: self } } #[doc = "Bit 6 - MCMP1"] #[inline(always)] pub fn mcmp1(&mut self) -> MCMP1_W { MCMP1_W { w: self } } #[doc = "Bit 5 - MREP"] #[inline(always)] pub fn mrep(&mut self) -> MREP_W { MREP_W { w: self } } #[doc = "Bit 4 - MPER"] #[inline(always)] pub fn mper(&mut self) -> MPER_W { MPER_W { w: self } } #[doc = "Bit 3 - MCNT"] #[inline(always)] pub fn mcnt(&mut self) -> MCNT_W { MCNT_W { w: self } } #[doc = "Bit 2 - MDIER"] #[inline(always)] pub fn mdier(&mut self) -> MDIER_W { MDIER_W { w: self } } #[doc = "Bit 1 - MICR"] #[inline(always)] pub fn micr(&mut self) -> MICR_W { MICR_W { w: self } } #[doc = "Bit 0 - MCR"] #[inline(always)] pub fn mcr(&mut self) -> MCR_W { MCR_W { w: self } } }
use std::fmt; #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum HeaderFlag { QueryRespone, AuthAnswer, Truncation, RecursionDesired, RecursionAvailable, AuthenticData, CheckDisable, } impl HeaderFlag { pub fn flag_mask(self) -> u16 { match self { HeaderFlag::QueryRespone => 0x8000, HeaderFlag::AuthAnswer => 0x0400, HeaderFlag::Truncation => 0x0200, HeaderFlag::RecursionDesired => 0x0100, HeaderFlag::RecursionAvailable => 0x0080, HeaderFlag::AuthenticData => 0x0020, HeaderFlag::CheckDisable => 0x0010, } } pub fn to_str(self) -> &'static str { match self { HeaderFlag::QueryRespone => "qr", HeaderFlag::AuthAnswer => "aa", HeaderFlag::Truncation => "tc", HeaderFlag::RecursionDesired => "rd", HeaderFlag::RecursionAvailable => "ra", HeaderFlag::AuthenticData => "ad", HeaderFlag::CheckDisable => "cd", } } } impl fmt::Display for HeaderFlag { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(&self.to_str()) } } pub fn set_flag(header_flags: &mut u16, flag: HeaderFlag) { *header_flags |= flag.flag_mask() } pub fn clear_flag(header_flags: &mut u16, flag: HeaderFlag) { *header_flags &= !flag.flag_mask() } pub fn is_flag_set(header_flags: u16, flag: HeaderFlag) -> bool { (header_flags & flag.flag_mask()) != 0 } pub fn setted_flags(header_flags: u16) -> Vec<HeaderFlag> { let mut flags = vec![ HeaderFlag::QueryRespone, HeaderFlag::AuthAnswer, HeaderFlag::Truncation, HeaderFlag::RecursionDesired, HeaderFlag::RecursionAvailable, HeaderFlag::AuthenticData, HeaderFlag::CheckDisable, ]; flags.retain(|&flag| is_flag_set(header_flags, flag)); flags }
//! The python `time` module. // See also: // https://docs.python.org/3/library/time.html pub use time::*; #[pymodule(name = "time", with(platform))] mod time { use crate::{ builtins::{PyStrRef, PyTypeRef}, function::{Either, FuncArgs, OptionalArg}, types::PyStructSequence, PyObjectRef, PyResult, TryFromObject, VirtualMachine, }; use chrono::{ naive::{NaiveDate, NaiveDateTime, NaiveTime}, Datelike, Timelike, }; use std::time::Duration; #[allow(dead_code)] pub(super) const SEC_TO_MS: i64 = 1000; #[allow(dead_code)] pub(super) const MS_TO_US: i64 = 1000; #[allow(dead_code)] pub(super) const SEC_TO_US: i64 = SEC_TO_MS * MS_TO_US; #[allow(dead_code)] pub(super) const US_TO_NS: i64 = 1000; #[allow(dead_code)] pub(super) const MS_TO_NS: i64 = MS_TO_US * US_TO_NS; #[allow(dead_code)] pub(super) const SEC_TO_NS: i64 = SEC_TO_MS * MS_TO_NS; #[allow(dead_code)] pub(super) const NS_TO_MS: i64 = 1000 * 1000; #[allow(dead_code)] pub(super) const NS_TO_US: i64 = 1000; fn duration_since_system_now(vm: &VirtualMachine) -> PyResult<Duration> { use std::time::{SystemTime, UNIX_EPOCH}; SystemTime::now() .duration_since(UNIX_EPOCH) .map_err(|e| vm.new_value_error(format!("Time error: {e:?}"))) } // TODO: implement proper monotonic time for wasm/wasi. #[cfg(not(any(unix, windows)))] fn get_monotonic_time(vm: &VirtualMachine) -> PyResult<Duration> { duration_since_system_now(vm) } // TODO: implement proper perf time for wasm/wasi. #[cfg(not(any(unix, windows)))] fn get_perf_time(vm: &VirtualMachine) -> PyResult<Duration> { duration_since_system_now(vm) } #[cfg(not(unix))] #[pyfunction] fn sleep(dur: Duration) { std::thread::sleep(dur); } #[cfg(not(target_os = "wasi"))] #[pyfunction] fn time_ns(vm: &VirtualMachine) -> PyResult<u64> { Ok(duration_since_system_now(vm)?.as_nanos() as u64) } #[pyfunction] pub fn time(vm: &VirtualMachine) -> PyResult<f64> { _time(vm) } #[cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))] fn _time(vm: &VirtualMachine) -> PyResult<f64> { Ok(duration_since_system_now(vm)?.as_secs_f64()) } #[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))] fn _time(_vm: &VirtualMachine) -> PyResult<f64> { use wasm_bindgen::prelude::*; #[wasm_bindgen] extern "C" { type Date; #[wasm_bindgen(static_method_of = Date)] fn now() -> f64; } // Date.now returns unix time in milliseconds, we want it in seconds Ok(Date::now() / 1000.0) } #[pyfunction] fn monotonic(vm: &VirtualMachine) -> PyResult<f64> { Ok(get_monotonic_time(vm)?.as_secs_f64()) } #[pyfunction] fn monotonic_ns(vm: &VirtualMachine) -> PyResult<u128> { Ok(get_monotonic_time(vm)?.as_nanos()) } #[pyfunction] fn perf_counter(vm: &VirtualMachine) -> PyResult<f64> { Ok(get_perf_time(vm)?.as_secs_f64()) } #[pyfunction] fn perf_counter_ns(vm: &VirtualMachine) -> PyResult<u128> { Ok(get_perf_time(vm)?.as_nanos()) } fn pyobj_to_naive_date_time( value: Either<f64, i64>, vm: &VirtualMachine, ) -> PyResult<NaiveDateTime> { let timestamp = match value { Either::A(float) => { let secs = float.trunc() as i64; let nsecs = (float.fract() * 1e9) as u32; NaiveDateTime::from_timestamp_opt(secs, nsecs) } Either::B(int) => NaiveDateTime::from_timestamp_opt(int, 0), }; timestamp.ok_or_else(|| { vm.new_overflow_error("timestamp out of range for platform time_t".to_owned()) }) } impl OptionalArg<Either<f64, i64>> { /// Construct a localtime from the optional seconds, or get the current local time. fn naive_or_local(self, vm: &VirtualMachine) -> PyResult<NaiveDateTime> { Ok(match self { OptionalArg::Present(secs) => pyobj_to_naive_date_time(secs, vm)?, OptionalArg::Missing => chrono::offset::Local::now().naive_local(), }) } fn naive_or_utc(self, vm: &VirtualMachine) -> PyResult<NaiveDateTime> { Ok(match self { OptionalArg::Present(secs) => pyobj_to_naive_date_time(secs, vm)?, OptionalArg::Missing => chrono::offset::Utc::now().naive_utc(), }) } } impl OptionalArg<PyStructTime> { fn naive_or_local(self, vm: &VirtualMachine) -> PyResult<NaiveDateTime> { Ok(match self { OptionalArg::Present(t) => t.to_date_time(vm)?, OptionalArg::Missing => chrono::offset::Local::now().naive_local(), }) } } /// https://docs.python.org/3/library/time.html?highlight=gmtime#time.gmtime #[pyfunction] fn gmtime(secs: OptionalArg<Either<f64, i64>>, vm: &VirtualMachine) -> PyResult<PyStructTime> { let instant = secs.naive_or_utc(vm)?; Ok(PyStructTime::new(vm, instant, 0)) } #[pyfunction] fn localtime( secs: OptionalArg<Either<f64, i64>>, vm: &VirtualMachine, ) -> PyResult<PyStructTime> { let instant = secs.naive_or_local(vm)?; // TODO: isdst flag must be valid value here // https://docs.python.org/3/library/time.html#time.localtime Ok(PyStructTime::new(vm, instant, -1)) } #[pyfunction] fn mktime(t: PyStructTime, vm: &VirtualMachine) -> PyResult<f64> { let datetime = t.to_date_time(vm)?; let seconds_since_epoch = datetime.timestamp() as f64; Ok(seconds_since_epoch) } const CFMT: &str = "%a %b %e %H:%M:%S %Y"; #[pyfunction] fn asctime(t: OptionalArg<PyStructTime>, vm: &VirtualMachine) -> PyResult { let instant = t.naive_or_local(vm)?; let formatted_time = instant.format(CFMT).to_string(); Ok(vm.ctx.new_str(formatted_time).into()) } #[pyfunction] fn ctime(secs: OptionalArg<Either<f64, i64>>, vm: &VirtualMachine) -> PyResult<String> { let instant = secs.naive_or_local(vm)?; Ok(instant.format(CFMT).to_string()) } #[pyfunction] fn strftime(format: PyStrRef, t: OptionalArg<PyStructTime>, vm: &VirtualMachine) -> PyResult { use std::fmt::Write; let instant = t.naive_or_local(vm)?; let mut formatted_time = String::new(); /* * chrono doesn't support all formats and it * raises an error if unsupported format is supplied. * If error happens, we set result as input arg. */ write!(&mut formatted_time, "{}", instant.format(format.as_str())) .unwrap_or_else(|_| formatted_time = format.to_string()); Ok(vm.ctx.new_str(formatted_time).into()) } #[pyfunction] fn strptime( string: PyStrRef, format: OptionalArg<PyStrRef>, vm: &VirtualMachine, ) -> PyResult<PyStructTime> { let format = format.as_ref().map_or("%a %b %H:%M:%S %Y", |s| s.as_str()); let instant = NaiveDateTime::parse_from_str(string.as_str(), format) .map_err(|e| vm.new_value_error(format!("Parse error: {e:?}")))?; Ok(PyStructTime::new(vm, instant, -1)) } #[cfg(not(any( windows, target_vendor = "apple", target_os = "android", target_os = "dragonfly", target_os = "freebsd", target_os = "linux", target_os = "fuchsia", target_os = "emscripten", )))] fn get_thread_time(vm: &VirtualMachine) -> PyResult<Duration> { Err(vm.new_not_implemented_error("thread time unsupported in this system".to_owned())) } #[pyfunction] fn thread_time(vm: &VirtualMachine) -> PyResult<f64> { Ok(get_thread_time(vm)?.as_secs_f64()) } #[pyfunction] fn thread_time_ns(vm: &VirtualMachine) -> PyResult<u64> { Ok(get_thread_time(vm)?.as_nanos() as u64) } #[cfg(any(windows, all(target_arch = "wasm32", target_arch = "emscripten")))] pub(super) fn time_muldiv(ticks: i64, mul: i64, div: i64) -> u64 { let intpart = ticks / div; let ticks = ticks % div; let remaining = (ticks * mul) / div; (intpart * mul + remaining) as u64 } #[cfg(all(target_arch = "wasm32", target_os = "emscripten"))] fn get_process_time(vm: &VirtualMachine) -> PyResult<Duration> { let t: libc::tms = unsafe { let mut t = std::mem::MaybeUninit::uninit(); if libc::times(t.as_mut_ptr()) == -1 { return Err(vm.new_os_error("Failed to get clock time".to_owned())); } t.assume_init() }; let freq = unsafe { libc::sysconf(libc::_SC_CLK_TCK) }; Ok(Duration::from_nanos( time_muldiv(t.tms_utime, SEC_TO_NS, freq) + time_muldiv(t.tms_stime, SEC_TO_NS, freq), )) } // same as the get_process_time impl for most unixes #[cfg(all(target_arch = "wasm32", target_os = "wasi"))] pub(super) fn get_process_time(vm: &VirtualMachine) -> PyResult<Duration> { let time: libc::timespec = unsafe { let mut time = std::mem::MaybeUninit::uninit(); if libc::clock_gettime(libc::CLOCK_PROCESS_CPUTIME_ID, time.as_mut_ptr()) == -1 { return Err(vm.new_os_error("Failed to get clock time".to_owned())); } time.assume_init() }; Ok(Duration::new(time.tv_sec as u64, time.tv_nsec as u32)) } #[cfg(not(any( windows, target_os = "macos", target_os = "android", target_os = "dragonfly", target_os = "freebsd", target_os = "linux", target_os = "illumos", target_os = "netbsd", target_os = "solaris", target_os = "openbsd", target_os = "redox", all(target_arch = "wasm32", not(target_os = "unknown")) )))] fn get_process_time(vm: &VirtualMachine) -> PyResult<Duration> { Err(vm.new_not_implemented_error("process time unsupported in this system".to_owned())) } #[pyfunction] fn process_time(vm: &VirtualMachine) -> PyResult<f64> { Ok(get_process_time(vm)?.as_secs_f64()) } #[pyfunction] fn process_time_ns(vm: &VirtualMachine) -> PyResult<u64> { Ok(get_process_time(vm)?.as_nanos() as u64) } #[pyattr] #[pyclass(name = "struct_time")] #[derive(PyStructSequence, TryIntoPyStructSequence)] #[allow(dead_code)] struct PyStructTime { tm_year: PyObjectRef, tm_mon: PyObjectRef, tm_mday: PyObjectRef, tm_hour: PyObjectRef, tm_min: PyObjectRef, tm_sec: PyObjectRef, tm_wday: PyObjectRef, tm_yday: PyObjectRef, tm_isdst: PyObjectRef, } impl std::fmt::Debug for PyStructTime { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "struct_time()") } } #[pyclass(with(PyStructSequence))] impl PyStructTime { fn new(vm: &VirtualMachine, tm: NaiveDateTime, isdst: i32) -> Self { PyStructTime { tm_year: vm.ctx.new_int(tm.year()).into(), tm_mon: vm.ctx.new_int(tm.month()).into(), tm_mday: vm.ctx.new_int(tm.day()).into(), tm_hour: vm.ctx.new_int(tm.hour()).into(), tm_min: vm.ctx.new_int(tm.minute()).into(), tm_sec: vm.ctx.new_int(tm.second()).into(), tm_wday: vm.ctx.new_int(tm.weekday().num_days_from_monday()).into(), tm_yday: vm.ctx.new_int(tm.ordinal()).into(), tm_isdst: vm.ctx.new_int(isdst).into(), } } fn to_date_time(&self, vm: &VirtualMachine) -> PyResult<NaiveDateTime> { let invalid_overflow = || vm.new_overflow_error("mktime argument out of range".to_owned()); let invalid_value = || vm.new_value_error("invalid struct_time parameter".to_owned()); macro_rules! field { ($field:ident) => { self.$field.clone().try_into_value(vm)? }; } let dt = NaiveDateTime::new( NaiveDate::from_ymd_opt(field!(tm_year), field!(tm_mon), field!(tm_mday)) .ok_or_else(invalid_value)?, NaiveTime::from_hms_opt(field!(tm_hour), field!(tm_min), field!(tm_sec)) .ok_or_else(invalid_overflow)?, ); Ok(dt) } #[pyslot] fn slot_new(_cls: PyTypeRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult { // cls is ignorable because this is not a basetype let seq = args.bind(vm)?; Ok(vm.new_pyobj(Self::try_from_object(vm, seq)?)) } } #[allow(unused_imports)] use super::platform::*; } #[cfg(unix)] #[pymodule(sub)] mod platform { #[allow(unused_imports)] use super::{SEC_TO_NS, US_TO_NS}; #[cfg_attr(target_os = "macos", allow(unused_imports))] use crate::{ builtins::{PyNamespace, PyStrRef}, convert::IntoPyException, PyObject, PyRef, PyResult, TryFromBorrowedObject, VirtualMachine, }; use nix::{sys::time::TimeSpec, time::ClockId}; use std::time::Duration; #[cfg(target_os = "solaris")] #[pyattr] use libc::CLOCK_HIGHRES; #[cfg(not(any( target_os = "illumos", target_os = "netbsd", target_os = "solaris", target_os = "openbsd", )))] #[pyattr] use libc::CLOCK_PROCESS_CPUTIME_ID; #[cfg(not(any( target_os = "illumos", target_os = "netbsd", target_os = "solaris", target_os = "openbsd", target_os = "redox", )))] #[pyattr] use libc::CLOCK_THREAD_CPUTIME_ID; #[cfg(target_os = "linux")] #[pyattr] use libc::{CLOCK_BOOTTIME, CLOCK_MONOTONIC_RAW, CLOCK_TAI}; #[pyattr] use libc::{CLOCK_MONOTONIC, CLOCK_REALTIME}; #[cfg(any(target_os = "freebsd", target_os = "openbsd", target_os = "dragonfly"))] #[pyattr] use libc::{CLOCK_PROF, CLOCK_UPTIME}; impl<'a> TryFromBorrowedObject<'a> for ClockId { fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> { obj.try_to_value(vm).map(ClockId::from_raw) } } fn get_clock_time(clk_id: ClockId, vm: &VirtualMachine) -> PyResult<Duration> { let ts = nix::time::clock_gettime(clk_id).map_err(|e| e.into_pyexception(vm))?; Ok(ts.into()) } #[pyfunction] fn clock_gettime(clk_id: ClockId, vm: &VirtualMachine) -> PyResult<f64> { get_clock_time(clk_id, vm).map(|d| d.as_secs_f64()) } #[pyfunction] fn clock_gettime_ns(clk_id: ClockId, vm: &VirtualMachine) -> PyResult<u128> { get_clock_time(clk_id, vm).map(|d| d.as_nanos()) } #[cfg(not(target_os = "redox"))] #[pyfunction] fn clock_getres(clk_id: ClockId, vm: &VirtualMachine) -> PyResult<f64> { let ts = nix::time::clock_getres(clk_id).map_err(|e| e.into_pyexception(vm))?; Ok(Duration::from(ts).as_secs_f64()) } #[cfg(not(target_os = "redox"))] #[cfg(not(target_vendor = "apple"))] fn set_clock_time(clk_id: ClockId, timespec: TimeSpec, vm: &VirtualMachine) -> PyResult<()> { nix::time::clock_settime(clk_id, timespec).map_err(|e| e.into_pyexception(vm)) } #[cfg(not(target_os = "redox"))] #[cfg(target_os = "macos")] fn set_clock_time(clk_id: ClockId, timespec: TimeSpec, vm: &VirtualMachine) -> PyResult<()> { // idk why nix disables clock_settime on macos let ret = unsafe { libc::clock_settime(clk_id.as_raw(), timespec.as_ref()) }; nix::Error::result(ret) .map(drop) .map_err(|e| e.into_pyexception(vm)) } #[cfg(not(target_os = "redox"))] #[cfg(any(not(target_vendor = "apple"), target_os = "macos"))] #[pyfunction] fn clock_settime(clk_id: ClockId, time: Duration, vm: &VirtualMachine) -> PyResult<()> { set_clock_time(clk_id, time.into(), vm) } #[cfg(not(target_os = "redox"))] #[cfg(any(not(target_vendor = "apple"), target_os = "macos"))] #[pyfunction] fn clock_settime_ns(clk_id: ClockId, time: libc::time_t, vm: &VirtualMachine) -> PyResult<()> { let ts = Duration::from_nanos(time as _).into(); set_clock_time(clk_id, ts, vm) } // Requires all CLOCK constants available and clock_getres #[cfg(any( target_os = "macos", target_os = "android", target_os = "dragonfly", target_os = "freebsd", target_os = "fuchsia", target_os = "emscripten", target_os = "linux", ))] #[pyfunction] fn get_clock_info(name: PyStrRef, vm: &VirtualMachine) -> PyResult<PyRef<PyNamespace>> { let (adj, imp, mono, res) = match name.as_ref() { "monotonic" | "perf_counter" => ( false, "time.clock_gettime(CLOCK_MONOTONIC)", true, clock_getres(ClockId::CLOCK_MONOTONIC, vm)?, ), "process_time" => ( false, "time.clock_gettime(CLOCK_PROCESS_CPUTIME_ID)", true, clock_getres(ClockId::CLOCK_PROCESS_CPUTIME_ID, vm)?, ), "thread_time" => ( false, "time.clock_gettime(CLOCK_THREAD_CPUTIME_ID)", true, clock_getres(ClockId::CLOCK_THREAD_CPUTIME_ID, vm)?, ), "time" => ( true, "time.clock_gettime(CLOCK_REALTIME)", false, clock_getres(ClockId::CLOCK_REALTIME, vm)?, ), _ => return Err(vm.new_value_error("unknown clock".to_owned())), }; Ok(py_namespace!(vm, { "implementation" => vm.new_pyobj(imp), "monotonic" => vm.ctx.new_bool(mono), "adjustable" => vm.ctx.new_bool(adj), "resolution" => vm.ctx.new_float(res), })) } #[cfg(not(any( target_os = "macos", target_os = "android", target_os = "dragonfly", target_os = "freebsd", target_os = "fuchsia", target_os = "emscripten", target_os = "linux", )))] #[pyfunction] fn get_clock_info(_name: PyStrRef, vm: &VirtualMachine) -> PyResult<PyRef<PyNamespace>> { Err(vm.new_not_implemented_error("get_clock_info unsupported on this system".to_owned())) } pub(super) fn get_monotonic_time(vm: &VirtualMachine) -> PyResult<Duration> { get_clock_time(ClockId::CLOCK_MONOTONIC, vm) } pub(super) fn get_perf_time(vm: &VirtualMachine) -> PyResult<Duration> { get_clock_time(ClockId::CLOCK_MONOTONIC, vm) } #[pyfunction] fn sleep(dur: Duration, vm: &VirtualMachine) -> PyResult<()> { // this is basically std::thread::sleep, but that catches interrupts and we don't want to; let ts = TimeSpec::from(dur); let res = unsafe { libc::nanosleep(ts.as_ref(), std::ptr::null_mut()) }; let interrupted = res == -1 && nix::errno::errno() == libc::EINTR; if interrupted { vm.check_signals()?; } Ok(()) } #[cfg(not(any( target_os = "illumos", target_os = "netbsd", target_os = "openbsd", target_os = "redox" )))] pub(super) fn get_thread_time(vm: &VirtualMachine) -> PyResult<Duration> { get_clock_time(ClockId::CLOCK_THREAD_CPUTIME_ID, vm) } #[cfg(target_os = "solaris")] pub(super) fn get_thread_time(vm: &VirtualMachine) -> PyResult<Duration> { Ok(Duration::from_nanos(unsafe { libc::gethrvtime() })) } #[cfg(not(any( target_os = "illumos", target_os = "netbsd", target_os = "solaris", target_os = "openbsd", )))] pub(super) fn get_process_time(vm: &VirtualMachine) -> PyResult<Duration> { get_clock_time(ClockId::CLOCK_PROCESS_CPUTIME_ID, vm) } #[cfg(any( target_os = "illumos", target_os = "netbsd", target_os = "solaris", target_os = "openbsd", ))] pub(super) fn get_process_time(vm: &VirtualMachine) -> PyResult<Duration> { use nix::sys::resource::{getrusage, UsageWho}; fn from_timeval(tv: libc::timeval, vm: &VirtualMachine) -> PyResult<i64> { (|tv: libc::timeval| { let t = tv.tv_sec.checked_mul(SEC_TO_NS)?; let u = (tv.tv_usec as i64).checked_mul(US_TO_NS)?; t.checked_add(u) })(tv) .ok_or_else(|| { vm.new_overflow_error("timestamp too large to convert to i64".to_owned()) }) } let ru = getrusage(UsageWho::RUSAGE_SELF).map_err(|e| e.into_pyexception(vm))?; let utime = from_timeval(ru.user_time().into(), vm)?; let stime = from_timeval(ru.system_time().into(), vm)?; Ok(Duration::from_nanos((utime + stime) as u64)) } } #[cfg(windows)] #[pymodule] mod platform { use super::{time_muldiv, MS_TO_NS, SEC_TO_NS}; use crate::{ builtins::{PyNamespace, PyStrRef}, stdlib::os::errno_err, PyRef, PyResult, VirtualMachine, }; use std::time::Duration; use winapi::shared::{minwindef::FILETIME, ntdef::ULARGE_INTEGER}; use winapi::um::processthreadsapi::{ GetCurrentProcess, GetCurrentThread, GetProcessTimes, GetThreadTimes, }; use winapi::um::profileapi::{QueryPerformanceCounter, QueryPerformanceFrequency}; use winapi::um::sysinfoapi::{GetSystemTimeAdjustment, GetTickCount64}; fn u64_from_filetime(time: FILETIME) -> u64 { unsafe { let mut large = std::mem::MaybeUninit::<ULARGE_INTEGER>::uninit(); { let m = (*large.as_mut_ptr()).u_mut(); m.LowPart = time.dwLowDateTime; m.HighPart = time.dwHighDateTime; } let large = large.assume_init(); *large.QuadPart() } } fn win_perf_counter_frequency(vm: &VirtualMachine) -> PyResult<i64> { let freq = unsafe { let mut freq = std::mem::MaybeUninit::uninit(); if QueryPerformanceFrequency(freq.as_mut_ptr()) == 0 { return Err(errno_err(vm)); } freq.assume_init() }; let frequency = unsafe { freq.QuadPart() }; if *frequency < 1 { Err(vm.new_runtime_error("invalid QueryPerformanceFrequency".to_owned())) } else if *frequency > i64::MAX / SEC_TO_NS { Err(vm.new_overflow_error("QueryPerformanceFrequency is too large".to_owned())) } else { Ok(*frequency) } } fn global_frequency(vm: &VirtualMachine) -> PyResult<i64> { rustpython_common::static_cell! { static FREQUENCY: PyResult<i64>; }; FREQUENCY .get_or_init(|| win_perf_counter_frequency(vm)) .clone() } pub(super) fn get_perf_time(vm: &VirtualMachine) -> PyResult<Duration> { let now = unsafe { let mut performance_count = std::mem::MaybeUninit::uninit(); QueryPerformanceCounter(performance_count.as_mut_ptr()); performance_count.assume_init() }; let ticks = unsafe { now.QuadPart() }; Ok(Duration::from_nanos(time_muldiv( *ticks, SEC_TO_NS, global_frequency(vm)?, ))) } fn get_system_time_adjustment(vm: &VirtualMachine) -> PyResult<u32> { let mut _time_adjustment = std::mem::MaybeUninit::uninit(); let mut time_increment = std::mem::MaybeUninit::uninit(); let mut _is_time_adjustment_disabled = std::mem::MaybeUninit::uninit(); let time_increment = unsafe { if GetSystemTimeAdjustment( _time_adjustment.as_mut_ptr(), time_increment.as_mut_ptr(), _is_time_adjustment_disabled.as_mut_ptr(), ) == 0 { return Err(errno_err(vm)); } time_increment.assume_init() }; Ok(time_increment) } pub(super) fn get_monotonic_time(vm: &VirtualMachine) -> PyResult<Duration> { let ticks = unsafe { GetTickCount64() }; Ok(Duration::from_nanos( (ticks as i64).checked_mul(MS_TO_NS).ok_or_else(|| { vm.new_overflow_error("timestamp too large to convert to i64".to_owned()) })? as u64, )) } #[pyfunction] fn get_clock_info(name: PyStrRef, vm: &VirtualMachine) -> PyResult<PyRef<PyNamespace>> { let (adj, imp, mono, res) = match name.as_ref() { "monotonic" => ( false, "GetTickCount64()", true, get_system_time_adjustment(vm)? as f64 * 1e-7, ), "perf_counter" => ( false, "QueryPerformanceCounter()", true, 1.0 / (global_frequency(vm)? as f64), ), "process_time" => (false, "GetProcessTimes()", true, 1e-7), "thread_time" => (false, "GetThreadTimes()", true, 1e-7), "time" => ( true, "GetSystemTimeAsFileTime()", false, get_system_time_adjustment(vm)? as f64 * 1e-7, ), _ => return Err(vm.new_value_error("unknown clock".to_owned())), }; Ok(py_namespace!(vm, { "implementation" => vm.new_pyobj(imp), "monotonic" => vm.ctx.new_bool(mono), "adjustable" => vm.ctx.new_bool(adj), "resolution" => vm.ctx.new_float(res), })) } pub(super) fn get_thread_time(vm: &VirtualMachine) -> PyResult<Duration> { let (kernel_time, user_time) = unsafe { let mut _creation_time = std::mem::MaybeUninit::uninit(); let mut _exit_time = std::mem::MaybeUninit::uninit(); let mut kernel_time = std::mem::MaybeUninit::uninit(); let mut user_time = std::mem::MaybeUninit::uninit(); let thread = GetCurrentThread(); if GetThreadTimes( thread, _creation_time.as_mut_ptr(), _exit_time.as_mut_ptr(), kernel_time.as_mut_ptr(), user_time.as_mut_ptr(), ) == 0 { return Err(vm.new_os_error("Failed to get clock time".to_owned())); } (kernel_time.assume_init(), user_time.assume_init()) }; let k_time = u64_from_filetime(kernel_time); let u_time = u64_from_filetime(user_time); Ok(Duration::from_nanos((k_time + u_time) * 100)) } pub(super) fn get_process_time(vm: &VirtualMachine) -> PyResult<Duration> { let (kernel_time, user_time) = unsafe { let mut _creation_time = std::mem::MaybeUninit::uninit(); let mut _exit_time = std::mem::MaybeUninit::uninit(); let mut kernel_time = std::mem::MaybeUninit::uninit(); let mut user_time = std::mem::MaybeUninit::uninit(); let process = GetCurrentProcess(); if GetProcessTimes( process, _creation_time.as_mut_ptr(), _exit_time.as_mut_ptr(), kernel_time.as_mut_ptr(), user_time.as_mut_ptr(), ) == 0 { return Err(vm.new_os_error("Failed to get clock time".to_owned())); } (kernel_time.assume_init(), user_time.assume_init()) }; let k_time = u64_from_filetime(kernel_time); let u_time = u64_from_filetime(user_time); Ok(Duration::from_nanos((k_time + u_time) * 100)) } } // mostly for wasm32 #[cfg(not(any(unix, windows)))] #[pymodule(sub)] mod platform {}
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn serialize_operation_create_bot_version( input: &crate::input::CreateBotVersionInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_create_bot_version_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_create_intent_version( input: &crate::input::CreateIntentVersionInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_create_intent_version_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_create_slot_type_version( input: &crate::input::CreateSlotTypeVersionInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_create_slot_type_version_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_put_bot( input: &crate::input::PutBotInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_put_bot_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_put_bot_alias( input: &crate::input::PutBotAliasInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_put_bot_alias_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_put_intent( input: &crate::input::PutIntentInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_put_intent_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_put_slot_type( input: &crate::input::PutSlotTypeInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_put_slot_type_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_start_import( input: &crate::input::StartImportInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_start_import_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_start_migration( input: &crate::input::StartMigrationInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_start_migration_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) } pub fn serialize_operation_tag_resource( input: &crate::input::TagResourceInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_tag_resource_input(&mut object, input); object.finish(); Ok(smithy_http::body::SdkBody::from(out)) }
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. //! Monitor a process. //! //! This module only supports **Linux** platform. use std::collections::HashMap; use std::sync::Mutex; use crate::counter::{Counter, CounterVec}; use crate::desc::Desc; use crate::gauge::{Gauge, GaugeVec}; use crate::metrics::{Collector, Opts}; use crate::proto; /// The `pid_t` data type represents process IDs. pub use libc::pid_t; /// Six metrics per ProcessCollector. const METRICS_NUMBER: usize = 9; /// A collector which exports the current state of /// process metrics including cpu, memory and file descriptor usage as well as /// the process start time for the given process id. #[derive(Debug)] pub struct ProcessCollector { pid: pid_t, descs: Vec<Desc>, cpu_total: Mutex<Counter>, open_fds: Gauge, max_fds: Gauge, vsize: Gauge, rss: Gauge, swap: Gauge, threads: ThreadsCollector, start_time: Gauge, } impl ProcessCollector { /// Create a `ProcessCollector` with the given process id and namespace. pub fn new<S: Into<String>>(pid: pid_t, namespace: S) -> ProcessCollector { let namespace = namespace.into(); let mut descs = Vec::new(); let cpu_total = Counter::with_opts( Opts::new( "process_cpu_seconds_total", "Total user and system CPU time spent in \ seconds.", ) .namespace(namespace.clone()), ) .unwrap(); descs.extend(cpu_total.desc().into_iter().cloned()); let open_fds = Gauge::with_opts( Opts::new("process_open_fds", "Number of open file descriptors.") .namespace(namespace.clone()), ) .unwrap(); descs.extend(open_fds.desc().into_iter().cloned()); let max_fds = Gauge::with_opts( Opts::new( "process_max_fds", "Maximum number of open file descriptors.", ) .namespace(namespace.clone()), ) .unwrap(); descs.extend(max_fds.desc().into_iter().cloned()); let vsize = Gauge::with_opts( Opts::new( "process_virtual_memory_bytes", "Virtual memory size in bytes.", ) .namespace(namespace.clone()), ) .unwrap(); descs.extend(vsize.desc().into_iter().cloned()); let rss = Gauge::with_opts( Opts::new( "process_resident_memory_bytes", "Resident memory size in bytes.", ) .namespace(namespace.clone()), ) .unwrap(); descs.extend(rss.desc().into_iter().cloned()); let swap = Gauge::with_opts( Opts::new( "process_swap_memory_bytes", "Swapped out memory size in bytes.", ) .namespace(namespace.clone()), ) .unwrap(); descs.extend(swap.desc().into_iter().cloned()); let start_time = Gauge::with_opts( Opts::new( "process_start_time_seconds", "Start time of the process since unix epoch \ in seconds.", ) .namespace(namespace.clone()), ) .unwrap(); descs.extend(start_time.desc().into_iter().cloned()); let threads = ThreadsCollector::new(pid); descs.extend(threads.desc().into_iter().cloned()); ProcessCollector { pid, descs, cpu_total: Mutex::new(cpu_total), open_fds, max_fds, vsize, rss, swap, threads, start_time, } } /// Return a `ProcessCollector` of the calling process. pub fn for_self() -> ProcessCollector { let pid = unsafe { libc::getpid() }; ProcessCollector::new(pid, "") } } impl Collector for ProcessCollector { fn desc(&self) -> Vec<&Desc> { self.descs.iter().collect() } fn collect(&self) -> Vec<proto::MetricFamily> { let p = match procfs::process::Process::new(self.pid) { Ok(p) => p, Err(..) => { // we can't construct a Process object, so there's no stats to gather return Vec::new(); } }; // file descriptors if let Ok(fd_list) = p.fd() { self.open_fds.set(fd_list.len() as f64); } if let Ok(limits) = p.limits() { if let procfs::process::LimitValue::Value(max) = limits.max_open_files.soft_limit { self.max_fds.set(max as f64) } } // memory self.vsize.set(p.stat.vsize as f64); self.rss.set(p.stat.rss as f64 * *PAGESIZE); if let Ok(status) = p.status() { if let Some(swap) = status.vmswap { self.swap.set(swap as f64); } } // proc_start_time if let Some(boot_time) = *BOOT_TIME { self.start_time .set(p.stat.starttime as f64 / *CLK_TCK + boot_time); } // cpu let cpu_total_mfs = { let cpu_total = self.cpu_total.lock().unwrap(); let delta = collect_cpu_stat(&cpu_total, &p.stat); if delta > 0.0 { cpu_total.inc_by(delta); } cpu_total.collect() }; // collect MetricFamilys. let mut mfs = Vec::with_capacity(METRICS_NUMBER); mfs.extend(cpu_total_mfs); mfs.extend(self.open_fds.collect()); mfs.extend(self.max_fds.collect()); mfs.extend(self.vsize.collect()); mfs.extend(self.rss.collect()); mfs.extend(self.swap.collect()); mfs.extend(self.start_time.collect()); mfs.extend(self.threads.collect()); mfs } } #[derive(Debug)] struct ThreadsCollector { inner: Mutex<TcInner>, descs: Vec<Desc>, } #[derive(Debug)] struct TcInner { known_threads: HashMap<String, ThreadStats>, pid: pid_t, total_cpu_vec: CounterVec, thread_count_vec: GaugeVec, } impl ThreadsCollector { fn new(pid: pid_t) -> ThreadsCollector { let known_threads = HashMap::new(); let total_cpu_vec = CounterVec::new( Opts::new( "process_thread_cpu_seconds_total", "The total time spent by all threads with this name.", ), &["thread_name"], ) .unwrap(); let thread_count_vec = GaugeVec::new( Opts::new("process_thread_count", "Number of threads with this name"), &["thread_name"], ) .unwrap(); let mut descs = Vec::new(); descs.extend(thread_count_vec.desc().into_iter().cloned()); descs.extend(total_cpu_vec.desc().into_iter().cloned()); ThreadsCollector { inner: Mutex::new(TcInner { known_threads, pid, total_cpu_vec, thread_count_vec, }), descs, } } } impl Collector for ThreadsCollector { fn desc(&self) -> Vec<&Desc> { self.descs.iter().collect() } fn collect(&self) -> Vec<proto::MetricFamily> { let mut tc = self.inner.lock().unwrap(); let p = match procfs::process::Process::new(tc.pid) { Ok(p) => p, Err(..) => { // we can't construct a Process object, so there's no stats to gather return Vec::new(); } }; if let Ok(threads) = p.tasks() { // Thread errors can happen when the thread is completed while we're inspecting for thread in threads.flat_map(|t_result| t_result) { let name = match thread.stat() { Ok(stat) => stat.comm, Err(_) => continue, }; let stats = match tc.known_threads.get_mut(&name) { Some(thread) => thread, None => { let total_cpu = tc.total_cpu_vec.with_label_values(&[&name]); let thread_count = tc.thread_count_vec.with_label_values(&[&name]); tc.known_threads // use entry instead of insert to get a reference to // the newly inserted stats .entry(name.clone()) .or_insert(ThreadStats::new(total_cpu, thread_count)) } }; stats.update(&thread); } } let mut mfs = Vec::new(); for (_, ts) in tc.known_threads.iter_mut() { ts.finish(&mut mfs); } mfs } } #[derive(Debug)] struct ThreadStats { total_cpu: Counter, count: Gauge, local_total: u64, local_count: f64, } impl ThreadStats { fn new(total_cpu: Counter, count: Gauge) -> ThreadStats { ThreadStats { total_cpu, count, local_total: 0, local_count: 0.0, } } fn update(&mut self, thread: &procfs::process::Task) { self.local_count += 1.0; if let Ok(stat) = thread.stat() { self.local_total += stat.utime + stat.stime; } } /// Extend metric families with data for threads that were found on this last iteration fn finish(&mut self, metric_families: &mut Vec<proto::MetricFamily>) { if self.local_count != 0.0 { self.count.set(self.local_count); let past = self.total_cpu.get(); let total = self.local_total as f64 / *CLK_TCK; let delta = total - past; if delta > 0.0 { self.total_cpu.inc_by(delta); } self.local_count = 0.0; self.local_total = 0; metric_families.extend(self.count.collect()); metric_families.extend(self.total_cpu.collect()); } } } fn collect_cpu_stat(cpu_total: &Counter, stat: &procfs::process::Stat) -> f64 { let total = (stat.utime + stat.stime) as f64 / *CLK_TCK; let past = cpu_total.get(); total - past } lazy_static! { // getconf CLK_TCK static ref CLK_TCK: f64 = { unsafe { libc::sysconf(libc::_SC_CLK_TCK) as f64 } }; // getconf PAGESIZE static ref PAGESIZE: f64 = { unsafe { libc::sysconf(libc::_SC_PAGESIZE) as f64 } }; } lazy_static! { static ref BOOT_TIME: Option<f64> = procfs::boot_time_secs().ok().map(|i| i as f64); } #[cfg(test)] mod tests { use super::*; use crate::metrics::Collector; use crate::registry; #[test] fn test_process_collector() { let pc = ProcessCollector::for_self(); { // Ensure that we have at least the right number of metrics let descs = pc.desc(); for desc in &descs { println!("{:?}", desc); } assert_eq!( descs.len(), super::METRICS_NUMBER, "descs count ({}) should match expected actual ({})", descs.len(), super::METRICS_NUMBER ); let mfs = pc.collect(); assert!( mfs.len() >= super::METRICS_NUMBER, "MetricFamilies count ({}) should be gte actual {}", mfs.len(), super::METRICS_NUMBER ); } let r = registry::Registry::new(); let res = r.register(Box::new(pc)); assert!(res.is_ok()); r.gather(); } }
#[doc = r" Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Start ECB block encrypt"] pub tasks_startecb: TASKS_STARTECB, #[doc = "0x04 - Abort a possible executing ECB operation"] pub tasks_stopecb: TASKS_STOPECB, _reserved2: [u8; 248usize], #[doc = "0x100 - ECB block encrypt complete"] pub events_endecb: EVENTS_ENDECB, #[doc = "0x104 - ECB block encrypt aborted because of a STOPECB task or due to an error"] pub events_errorecb: EVENTS_ERRORECB, _reserved4: [u8; 508usize], #[doc = "0x304 - Enable interrupt"] pub intenset: INTENSET, #[doc = "0x308 - Disable interrupt"] pub intenclr: INTENCLR, _reserved6: [u8; 504usize], #[doc = "0x504 - ECB block encrypt memory pointers"] pub ecbdataptr: ECBDATAPTR, } #[doc = "Start ECB block encrypt"] pub struct TASKS_STARTECB { register: ::vcell::VolatileCell<u32>, } #[doc = "Start ECB block encrypt"] pub mod tasks_startecb; #[doc = "Abort a possible executing ECB operation"] pub struct TASKS_STOPECB { register: ::vcell::VolatileCell<u32>, } #[doc = "Abort a possible executing ECB operation"] pub mod tasks_stopecb; #[doc = "ECB block encrypt complete"] pub struct EVENTS_ENDECB { register: ::vcell::VolatileCell<u32>, } #[doc = "ECB block encrypt complete"] pub mod events_endecb; #[doc = "ECB block encrypt aborted because of a STOPECB task or due to an error"] pub struct EVENTS_ERRORECB { register: ::vcell::VolatileCell<u32>, } #[doc = "ECB block encrypt aborted because of a STOPECB task or due to an error"] pub mod events_errorecb; #[doc = "Enable interrupt"] pub struct INTENSET { register: ::vcell::VolatileCell<u32>, } #[doc = "Enable interrupt"] pub mod intenset; #[doc = "Disable interrupt"] pub struct INTENCLR { register: ::vcell::VolatileCell<u32>, } #[doc = "Disable interrupt"] pub mod intenclr; #[doc = "ECB block encrypt memory pointers"] pub struct ECBDATAPTR { register: ::vcell::VolatileCell<u32>, } #[doc = "ECB block encrypt memory pointers"] pub mod ecbdataptr;
use crate::device::Device; use crate::measurement::{Measureable, Measurement}; use crate::types::convert_hydra_harp_result; use pyo3::exceptions; use pyo3::prelude::*; use pyo3::wrap_pyfunction; use std::collections::VecDeque; use std::thread::sleep; use std::time::Duration; fn unwrap_or_value_error<T>(x: i32) -> PyResult<T> where T: num::FromPrimitive, { match num::FromPrimitive::from_i32(x) { Some(r) => Ok(r), _ => Err(exceptions::ValueError.into()), } } #[pyfunction] pub fn open_device(id: i32) -> PyResult<Device> { convert_hydra_harp_result(Device::open_device(id)) } #[pyfunction] /// Try to close this device pub fn close_device(d: &mut Device) -> PyResult<()> { convert_hydra_harp_result(d.close_device()) } #[pyfunction] /// Initialise the device. Should be done before other functions are run pub fn initialise(d: &mut Device, mode: i32, ref_source: i32) -> PyResult<()> { convert_hydra_harp_result(d.initialise( unwrap_or_value_error(mode)?, unwrap_or_value_error(ref_source)?, )) } #[pyfunction] pub fn get_base_resolution(d: &mut Device) -> PyResult<(f64, i32)> { convert_hydra_harp_result(d.get_base_resolution()) } #[pyfunction] pub fn get_number_of_input_channels(d: &mut Device) -> PyResult<i32> { convert_hydra_harp_result(d.get_number_of_input_channels()) } #[pyfunction] pub fn calibrate(d: &mut Device) -> PyResult<()> { convert_hydra_harp_result(d.calibrate()) } #[pyfunction] pub fn set_sync_divider(d: &mut Device, divisions: i32) -> PyResult<()> { convert_hydra_harp_result(d.set_sync_divider(divisions)) } #[pyfunction] pub fn set_sync_CFD(d: &mut Device, level: i32, zerox: i32) -> PyResult<()> { convert_hydra_harp_result(d.set_sync_CFD(level, zerox)) } #[pyfunction] pub fn set_sync_channel_offset(d: &mut Device, offset: i32) -> PyResult<()> { convert_hydra_harp_result(d.set_sync_channel_offset(offset)) } #[pyfunction] pub fn set_input_CFD(d: &mut Device, channel: i32, level: i32, zerox: i32) -> PyResult<()> { convert_hydra_harp_result(d.set_input_CFD(channel, level, zerox)) } #[pyfunction] pub fn set_input_channel_offset(d: &mut Device, channel: i32, offset: i32) -> PyResult<()> { convert_hydra_harp_result(d.set_input_channel_offset(channel, offset)) } #[pyfunction] pub fn set_input_channel_enabled(d: &mut Device, channel: i32, enabled: bool) -> PyResult<()> { convert_hydra_harp_result(d.set_input_channel_enabled(channel, enabled)) } #[pyfunction] pub fn set_stop_overflow(d: &mut Device, stop_ofl: bool, stopcount: u32) -> PyResult<()> { convert_hydra_harp_result(d.set_stop_overflow(stop_ofl, stopcount)) } #[pyfunction] pub fn set_binning(d: &mut Device, binning: i32) -> PyResult<()> { convert_hydra_harp_result(d.set_binning(binning)) } #[pyfunction] pub fn set_offset(d: &mut Device, offset: i32) -> PyResult<()> { convert_hydra_harp_result(d.set_offset(offset)) } // /// Set the histogram length. Returns the actual length calculated as `1024*(2^lencode)` // pub fn set_histogram_length(&mut self, length: i32) -> Result<i32, HydraHarpError> { // let mut actual_length: i32 = 0; // let return_val = error_enum_or_value! { // unsafe { // HH_SetHistoLen(self.id, length, &mut actual_length as *mut i32) // }, // actual_length // }; // if let Ok(len) = return_val { // self.histogram_length = Some(len as usize); // } // return_val // } /// Clear the histogram memory #[pyfunction] pub fn clear_histogram_memory(d: &mut Device) -> PyResult<()> { convert_hydra_harp_result(d.clear_histogram_memory()) } // /// Set the measurement control code and edges // pub fn set_measurement_control( // &mut self, // control: MeasurementControl, // start_edge: EdgeSelection, // stop_edge: EdgeSelection, // ) -> Result<(), HydraHarpError> { // error_enum_or_value! { // unsafe { // HH_SetMeasControl(self.id, num::ToPrimitive::to_i32(&control).unwrap(), // num::ToPrimitive::to_i32(&start_edge).unwrap(), // num::ToPrimitive::to_i32(&stop_edge).unwrap()) // }, // () // } // } #[pyfunction] pub fn start_measurement(d: &mut Device, acquisition_time: i32) -> PyResult<()> { convert_hydra_harp_result(d.start_measurement(acquisition_time)) } #[pyfunction] pub fn stop_measurement(d: &mut Device) -> PyResult<()> { convert_hydra_harp_result(d.stop_measurement()) } #[pyfunction] pub fn get_CTC_status(d: &mut Device) -> PyResult<i32> { match convert_hydra_harp_result(d.get_CTC_status()) { Ok(x) => Ok(num::ToPrimitive::to_i32(&x).unwrap()), Err(e) => Err(e), } } // /// Get the histogram from the device. Returns the error `HistogramLengthNotKnown` if // /// `self.histogram_length = None`. If clear is true then the acquisiton buffer is cleared upon reading, // /// otherwise it isn't // pub fn get_histogram(&mut self, channel: i32, clear: bool) -> Result<Vec<u32>, HydraHarpError> { // if let Some(histogram_length) = self.histogram_length { // // let mut histogram_data: Vec<u32> = Vec::with_capacity(histogram_length); // let mut histogram_data: Vec<u32> = vec![0; histogram_length]; // error_enum_or_value! { // unsafe { // HH_GetHistogram(self.id, histogram_data.as_mut_ptr(), channel, clear as i32) // }, // histogram_data // } // } else { // Err(HydraHarpError::HistogramLengthNotKnown) // } // } #[pyfunction] pub fn get_resolution(d: &mut Device) -> PyResult<f64> { convert_hydra_harp_result(d.get_resolution()) } #[pyfunction] pub fn get_sync_rate(d: &mut Device) -> PyResult<i32> { convert_hydra_harp_result(d.get_sync_rate()) } #[pyfunction] pub fn get_count_rate(d: &mut Device, channel: i32) -> PyResult<i32> { convert_hydra_harp_result(d.get_count_rate(channel)) } // /// get the current count rate // /// allow at least 100ms after initialise or set_sync_divider to get a stable meter reading // /// wait at least 100ms to get a new reading. This is the gate time of the counters // pub fn get_count_rate(&self, channel: i32) -> Result<i32, HydraHarpError> { // let mut count_rate: i32 = 0; // error_enum_or_value! { // unsafe { // HH_GetCountRate(self.id, channel, &mut count_rate as *mut i32) // }, // count_rate // } // } // /// get the flags. Use the `FLAG_*` variables to extract the different flags // pub fn get_flags(&self) -> Result<i32, HydraHarpError> { // let mut flags: i32 = 0; // error_enum_or_value! { // unsafe { // HH_GetFlags(self.id, &mut flags as *mut i32) // }, // flags // } // } #[pyfunction] pub fn get_elapsed_measurement_time(d: &mut Device) -> PyResult<f64> { convert_hydra_harp_result(d.get_elapsed_measurement_time()) } // /// get the warnings encoded bitwise // pub fn get_warnings(&self) -> Result<i32, HydraHarpError> { // let mut warnings: i32 = 0; // error_enum_or_value! { // unsafe { // HH_GetWarnings(self.id, &mut warnings as *mut i32) // }, // warnings // } // } // /// use in TTTR mode // /// `buffer` should be at least 128 records long // /// `records_to_fetch` should be a multiple of 128, less than the length of `buffer` and no longer than `TTREADMAX` // /// In the result, returns Ok(records_written), where records_written is the number of records actually written to the buffer // pub fn read_fifo( // &mut self, // buffer: &mut Vec<u32>, // records_to_fetch: i32, // ) -> Result<i32, HydraHarpError> { // let mut records_written: i32 = 0; // error_enum_or_value! { // unsafe { // HH_ReadFiFo( // self.id, buffer.as_mut_ptr(), records_to_fetch, // &mut records_written as *mut i32 // ) // }, // records_written // } // } // /// Use in TTTR mode // /// set the marker edges // pub fn set_marker_edges( // &mut self, // me1: EdgeSelection, // me2: EdgeSelection, // me3: EdgeSelection, // me4: EdgeSelection, // ) -> Result<(), HydraHarpError> { // error_enum_or_value! { // unsafe { // HH_SetMarkerEdges(self.id, // num::ToPrimitive::to_i32(&me1).unwrap(), // num::ToPrimitive::to_i32(&me2).unwrap(), // num::ToPrimitive::to_i32(&me3).unwrap(), // num::ToPrimitive::to_i32(&me4).unwrap()) // }, // () // } // } // /// Use in TTTR mode // /// enable or disable the marker edges // pub fn enable_marker_edges( // &mut self, // en1: bool, // en2: bool, // en3: bool, // en4: bool, // ) -> Result<(), HydraHarpError> { // error_enum_or_value! { // unsafe { // HH_SetMarkerEnable(self.id, en1 as i32, en2 as i32, en3 as i32, en4 as i32)}, // () // } // } // /// Use in TTTR mode // /// Set the marker holdoff time in ns // pub fn set_marker_holdoff_time(&mut self, holdoff_time: i32) -> Result<(), HydraHarpError> { // error_enum_or_value! { // unsafe { // HH_SetMarkerHoldoffTime(self.id, holdoff_time) // }, // () // } // } #[pyfunction] /// convert from a coincidence channel pair (c1, c2) into an index fn coincidence_channels_to_index(channels: (u8, u8)) -> usize { match channels { (0, 1) | (1, 0) => 0, (0, 2) | (2, 0) => 1, (0, 3) | (3, 0) => 2, (0, 4) | (4, 0) => 3, (0, 5) | (5, 0) => 4, (0, 6) | (6, 0) => 5, (0, 7) | (7, 0) => 6, (1, 2) | (2, 1) => 7, (1, 3) | (3, 1) => 8, (1, 4) | (4, 1) => 9, (1, 5) | (5, 1) => 10, (1, 6) | (6, 1) => 11, (1, 7) | (7, 1) => 12, (2, 3) | (3, 2) => 13, (2, 4) | (4, 2) => 14, (2, 5) | (5, 2) => 15, (2, 6) | (6, 2) => 16, (2, 7) | (7, 2) => 17, (3, 4) | (4, 3) => 18, (3, 5) | (5, 3) => 19, (3, 6) | (6, 3) => 20, (3, 7) | (7, 3) => 21, (4, 5) | (5, 4) => 22, (4, 6) | (6, 4) => 23, (4, 7) | (7, 4) => 24, (5, 6) | (6, 5) => 25, (5, 7) | (7, 5) => 26, (6, 7) | (7, 6) => 27, _ => 28, } } #[pyfunction] fn index_to_coincidence_channels(index: usize) -> (u8, u8) { match index { 0 => (0, 1), 1 => (0, 2), 2 => (0, 3), 3 => (0, 4), 4 => (0, 5), 5 => (0, 6), 6 => (0, 7), 7 => (1, 2), 8 => (1, 3), 9 => (1, 4), 10 => (1, 5), 11 => (1, 6), 12 => (1, 7), 13 => (2, 3), 14 => (2, 4), 15 => (2, 5), 16 => (2, 6), 17 => (2, 7), 18 => (3, 4), 19 => (3, 5), 20 => (3, 6), 21 => (3, 7), 22 => (4, 5), 23 => (4, 6), 24 => (4, 7), 25 => (5, 6), 26 => (5, 7), 27 => (6, 7), _ => (255, 255), } } /// Helper function to generate a vector of (histogram times, bin indices) /// use with if (time < histogram_time): bins[bin_index] += 1 fn generate_histogram_times( coincidence_window: usize, histogram_bins: usize, ) -> Vec<(usize, usize)> { let delta = (coincidence_window as f64) / (histogram_bins as f64); (1..=histogram_bins) .map(|x| (((x as f64) * delta).round() as usize, x - 1)) .collect() } /// Make a measurement for `acquisition_time` ms and return a tuple containing /// `([singles], [coincidences], [histograms])` /// where [histograms] is a vector containing the histogrammed times pub fn measure_and_get_counts( d: &mut Device, acquisition_time: i32, coincidence_window: u64, histogram_bins: usize, sync_channel: u8, ) -> PyResult<(Vec<usize>, Vec<usize>, Vec<Vec<usize>>)> { const buffer_length: usize = 131072; let mut buffer: [u32; buffer_length] = [0u32; buffer_length]; let mut measurement = Measurement::new(0); let mut sync_buffer: VecDeque<u64> = VecDeque::with_capacity(buffer_length); let mut singles = [0usize; 9]; // there are 9 channels on the hydraharp let mut coincidences = [0usize; 9]; // likewise let mut histograms = vec![vec![0; histogram_bins]; 9]; let histogram_times = generate_histogram_times(coincidence_window as usize, histogram_bins); convert_hydra_harp_result(d.start_measurement(acquisition_time))?; loop { // Read the values let num_read = convert_hydra_harp_result(d.read_fifo(&mut buffer, (buffer_length) as i32))? as usize; // If the number of values read is greater than 0, do stuff with them if num_read > 0 { // Convert the codes into channels and times let mut channel_times = measurement.convert_values_T2(&buffer[..num_read]); // Sort by time, just in case channel_times.sort_by_key(|(_, t)| *t); for &(channel, time) in channel_times.iter() { // Add to the singles singles[channel as usize] += 1; if channel == sync_channel { sync_buffer.push_back(time) } else { let mut remove_index = None; // Index of sync channel counts that are out of the coincidence window, to be removed // Go through all the times in the sync channel for (i, &sync_time) in sync_buffer.iter().enumerate() { // This 'if' should resolve the error where a time is less than sync time if time > sync_time { let delta_t = time - sync_time; if delta_t > coincidence_window { remove_index = Some(i); } else { // we have a coincidence - add to the coincidences coincidences[channel as usize] += 1; for &(bin_time, bin_index) in histogram_times.iter() { if delta_t < (bin_time as u64) { histograms[channel as usize][bin_index] += 1; break; } } } } } // TODO maybe only remove the last element of the vecdeque // each time round the measurement loop // it could be too slow this way... if let Some(i) = remove_index { sync_buffer.drain(0..i); } } } } else { if convert_hydra_harp_result(d.get_CTC_status())? == crate::types::CTCStatus::Ended { // Our measurement has ended, so get out of the loop break; } } } Ok((singles.to_vec(), coincidences.to_vec(), histograms)) } #[pymodule] fn hhlib_sys(_py: Python<'_>, m: &PyModule) -> PyResult<()> { m.add_wrapped(wrap_pyfunction!(open_device))?; m.add_wrapped(wrap_pyfunction!(close_device))?; m.add_wrapped(wrap_pyfunction!(initialise))?; m.add_wrapped(wrap_pyfunction!(get_base_resolution))?; m.add_wrapped(wrap_pyfunction!(get_number_of_input_channels))?; m.add_wrapped(wrap_pyfunction!(calibrate))?; m.add_wrapped(wrap_pyfunction!(set_sync_divider))?; m.add_wrapped(wrap_pyfunction!(set_sync_channel_offset))?; m.add_wrapped(wrap_pyfunction!(set_sync_CFD))?; m.add_wrapped(wrap_pyfunction!(set_input_CFD))?; m.add_wrapped(wrap_pyfunction!(set_input_channel_offset))?; m.add_wrapped(wrap_pyfunction!(set_input_channel_enabled))?; m.add_wrapped(wrap_pyfunction!(set_stop_overflow))?; m.add_wrapped(wrap_pyfunction!(set_binning))?; m.add_wrapped(wrap_pyfunction!(set_offset))?; m.add_wrapped(wrap_pyfunction!(clear_histogram_memory))?; m.add_wrapped(wrap_pyfunction!(start_measurement))?; m.add_wrapped(wrap_pyfunction!(stop_measurement))?; m.add_wrapped(wrap_pyfunction!(get_CTC_status))?; m.add_wrapped(wrap_pyfunction!(get_resolution))?; m.add_wrapped(wrap_pyfunction!(get_sync_rate))?; m.add_wrapped(wrap_pyfunction!(get_count_rate))?; m.add_wrapped(wrap_pyfunction!(get_elapsed_measurement_time))?; //m.add_wrapped(wrap_pyfunction!(measure_and_get_counts))?; m.add_wrapped(wrap_pyfunction!(coincidence_channels_to_index))?; m.add_wrapped(wrap_pyfunction!(index_to_coincidence_channels))?; #[pyfn(m, "measure_and_get_counts")] fn measure_and_get_counts_py( py: Python, d: &mut Device, acquisition_time: i32, coincidence_window: u64, histogram_bins: usize, sync_channel: u8, ) -> PyResult<(Vec<usize>, Vec<usize>, Vec<Vec<usize>>)> { py.allow_threads(move || { measure_and_get_counts( d, acquisition_time, coincidence_window, histogram_bins, sync_channel, ) }) }; Ok(()) }
use std::collections::HashMap; use std::string::CowString; use std::borrow::Cow; use compiler::{EnvVar, Syntax}; use primitive::libprimitive; /// Compiles the global env from `base` pub fn libbase() -> HashMap<CowString<'static>, EnvVar> { let mut lib = HashMap::new(); for &(name, ref func) in libprimitive().iter() { lib.insert(Cow::Borrowed(name), EnvVar::PrimFunc(name, func.clone())); } lib.insert(Cow::Borrowed("lambda"), EnvVar::Syntax(Syntax::Lambda)); return lib; }
use crate::window::{Window, Geometry}; use crate::stack::Stack; pub fn handle_layout<W>(view: &Geometry, windows: Stack<Window<W>>) -> Stack<Window<W>> { let window_count = windows.len(); if window_count == 0 { return windows; }; windows.into_iter().enumerate() .map(|(pos, (is_current, window))| { let width = if pos == 0 && window_count == 1 { view.size.width } else { view.size.width / 2 }; let height = if pos == 0 { view.size.height } else { view.size.height / (window_count as u32 - 1) }; let x = if pos == 0 { view.position.x } else { width as i32 } + view.position.x; let y = if pos == 0 { view.position.y } else { height as i32 * (pos as i32 - 1) } + view.position.y; (is_current, window.set_view(Geometry::new(x, y, width, height)).visible(true)) }) .collect() }
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn parse_http_generic_error( response: &http::Response<bytes::Bytes>, ) -> Result<smithy_types::Error, smithy_json::deserialize::Error> { crate::json_errors::parse_generic_error(response.body(), response.headers()) } pub fn deser_structure_activity_limit_exceededjson_err( input: &[u8], mut builder: crate::error::activity_limit_exceeded::Builder, ) -> Result<crate::error::activity_limit_exceeded::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_invalid_namejson_err( input: &[u8], mut builder: crate::error::invalid_name::Builder, ) -> Result<crate::error::invalid_name::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_too_many_tagsjson_err( input: &[u8], mut builder: crate::error::too_many_tags::Builder, ) -> Result<crate::error::too_many_tags::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "resourceName" => { builder = builder.set_resource_name( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_create_activity( input: &[u8], mut builder: crate::output::create_activity_output::Builder, ) -> Result<crate::output::create_activity_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "activityArn" => { builder = builder.set_activity_arn( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "creationDate" => { builder = builder.set_creation_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_invalid_arnjson_err( input: &[u8], mut builder: crate::error::invalid_arn::Builder, ) -> Result<crate::error::invalid_arn::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_invalid_definitionjson_err( input: &[u8], mut builder: crate::error::invalid_definition::Builder, ) -> Result<crate::error::invalid_definition::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_invalid_logging_configurationjson_err( input: &[u8], mut builder: crate::error::invalid_logging_configuration::Builder, ) -> Result<crate::error::invalid_logging_configuration::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_invalid_tracing_configurationjson_err( input: &[u8], mut builder: crate::error::invalid_tracing_configuration::Builder, ) -> Result<crate::error::invalid_tracing_configuration::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_state_machine_already_existsjson_err( input: &[u8], mut builder: crate::error::state_machine_already_exists::Builder, ) -> Result<crate::error::state_machine_already_exists::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_state_machine_deletingjson_err( input: &[u8], mut builder: crate::error::state_machine_deleting::Builder, ) -> Result<crate::error::state_machine_deleting::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_state_machine_limit_exceededjson_err( input: &[u8], mut builder: crate::error::state_machine_limit_exceeded::Builder, ) -> Result<crate::error::state_machine_limit_exceeded::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_state_machine_type_not_supportedjson_err( input: &[u8], mut builder: crate::error::state_machine_type_not_supported::Builder, ) -> Result<crate::error::state_machine_type_not_supported::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_create_state_machine( input: &[u8], mut builder: crate::output::create_state_machine_output::Builder, ) -> Result<crate::output::create_state_machine_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "stateMachineArn" => { builder = builder.set_state_machine_arn( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "creationDate" => { builder = builder.set_creation_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_activity_does_not_existjson_err( input: &[u8], mut builder: crate::error::activity_does_not_exist::Builder, ) -> Result<crate::error::activity_does_not_exist::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_describe_activity( input: &[u8], mut builder: crate::output::describe_activity_output::Builder, ) -> Result<crate::output::describe_activity_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "activityArn" => { builder = builder.set_activity_arn( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "creationDate" => { builder = builder.set_creation_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_execution_does_not_existjson_err( input: &[u8], mut builder: crate::error::execution_does_not_exist::Builder, ) -> Result<crate::error::execution_does_not_exist::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_describe_execution( input: &[u8], mut builder: crate::output::describe_execution_output::Builder, ) -> Result<crate::output::describe_execution_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "executionArn" => { builder = builder.set_execution_arn( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "stateMachineArn" => { builder = builder.set_state_machine_arn( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "status" => { builder = builder.set_status( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::ExecutionStatus::from(u.as_ref())) }) .transpose()?, ); } "startDate" => { builder = builder.set_start_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "stopDate" => { builder = builder.set_stop_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "input" => { builder = builder.set_input( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "inputDetails" => { builder = builder.set_input_details( crate::json_deser::deser_structure_cloud_watch_events_execution_data_details(tokens)? ); } "output" => { builder = builder.set_output( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "outputDetails" => { builder = builder.set_output_details( crate::json_deser::deser_structure_cloud_watch_events_execution_data_details(tokens)? ); } "traceHeader" => { builder = builder.set_trace_header( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_state_machine_does_not_existjson_err( input: &[u8], mut builder: crate::error::state_machine_does_not_exist::Builder, ) -> Result<crate::error::state_machine_does_not_exist::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_describe_state_machine( input: &[u8], mut builder: crate::output::describe_state_machine_output::Builder, ) -> Result<crate::output::describe_state_machine_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "stateMachineArn" => { builder = builder.set_state_machine_arn( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "status" => { builder = builder.set_status( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::StateMachineStatus::from(u.as_ref())) }) .transpose()?, ); } "definition" => { builder = builder.set_definition( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "roleArn" => { builder = builder.set_role_arn( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "type" => { builder = builder.set_type( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::StateMachineType::from(u.as_ref())) }) .transpose()?, ); } "creationDate" => { builder = builder.set_creation_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "loggingConfiguration" => { builder = builder.set_logging_configuration( crate::json_deser::deser_structure_logging_configuration(tokens)?, ); } "tracingConfiguration" => { builder = builder.set_tracing_configuration( crate::json_deser::deser_structure_tracing_configuration(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_describe_state_machine_for_execution( input: &[u8], mut builder: crate::output::describe_state_machine_for_execution_output::Builder, ) -> Result< crate::output::describe_state_machine_for_execution_output::Builder, smithy_json::deserialize::Error, > { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "stateMachineArn" => { builder = builder.set_state_machine_arn( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "definition" => { builder = builder.set_definition( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "roleArn" => { builder = builder.set_role_arn( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "updateDate" => { builder = builder.set_update_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "loggingConfiguration" => { builder = builder.set_logging_configuration( crate::json_deser::deser_structure_logging_configuration(tokens)?, ); } "tracingConfiguration" => { builder = builder.set_tracing_configuration( crate::json_deser::deser_structure_tracing_configuration(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_activity_worker_limit_exceededjson_err( input: &[u8], mut builder: crate::error::activity_worker_limit_exceeded::Builder, ) -> Result<crate::error::activity_worker_limit_exceeded::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_get_activity_task( input: &[u8], mut builder: crate::output::get_activity_task_output::Builder, ) -> Result<crate::output::get_activity_task_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "taskToken" => { builder = builder.set_task_token( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "input" => { builder = builder.set_input( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_invalid_tokenjson_err( input: &[u8], mut builder: crate::error::invalid_token::Builder, ) -> Result<crate::error::invalid_token::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_get_execution_history( input: &[u8], mut builder: crate::output::get_execution_history_output::Builder, ) -> Result<crate::output::get_execution_history_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "events" => { builder = builder .set_events(crate::json_deser::deser_list_history_event_list(tokens)?); } "nextToken" => { builder = builder.set_next_token( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_list_activities( input: &[u8], mut builder: crate::output::list_activities_output::Builder, ) -> Result<crate::output::list_activities_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "activities" => { builder = builder .set_activities(crate::json_deser::deser_list_activity_list(tokens)?); } "nextToken" => { builder = builder.set_next_token( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_list_executions( input: &[u8], mut builder: crate::output::list_executions_output::Builder, ) -> Result<crate::output::list_executions_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "executions" => { builder = builder .set_executions(crate::json_deser::deser_list_execution_list(tokens)?); } "nextToken" => { builder = builder.set_next_token( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_list_state_machines( input: &[u8], mut builder: crate::output::list_state_machines_output::Builder, ) -> Result<crate::output::list_state_machines_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "stateMachines" => { builder = builder.set_state_machines( crate::json_deser::deser_list_state_machine_list(tokens)?, ); } "nextToken" => { builder = builder.set_next_token( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_resource_not_foundjson_err( input: &[u8], mut builder: crate::error::resource_not_found::Builder, ) -> Result<crate::error::resource_not_found::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "resourceName" => { builder = builder.set_resource_name( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_list_tags_for_resource( input: &[u8], mut builder: crate::output::list_tags_for_resource_output::Builder, ) -> Result<crate::output::list_tags_for_resource_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "tags" => { builder = builder.set_tags(crate::json_deser::deser_list_tag_list(tokens)?); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_task_does_not_existjson_err( input: &[u8], mut builder: crate::error::task_does_not_exist::Builder, ) -> Result<crate::error::task_does_not_exist::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_task_timed_outjson_err( input: &[u8], mut builder: crate::error::task_timed_out::Builder, ) -> Result<crate::error::task_timed_out::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_invalid_outputjson_err( input: &[u8], mut builder: crate::error::invalid_output::Builder, ) -> Result<crate::error::invalid_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_execution_already_existsjson_err( input: &[u8], mut builder: crate::error::execution_already_exists::Builder, ) -> Result<crate::error::execution_already_exists::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_execution_limit_exceededjson_err( input: &[u8], mut builder: crate::error::execution_limit_exceeded::Builder, ) -> Result<crate::error::execution_limit_exceeded::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_invalid_execution_inputjson_err( input: &[u8], mut builder: crate::error::invalid_execution_input::Builder, ) -> Result<crate::error::invalid_execution_input::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_start_execution( input: &[u8], mut builder: crate::output::start_execution_output::Builder, ) -> Result<crate::output::start_execution_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "executionArn" => { builder = builder.set_execution_arn( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "startDate" => { builder = builder.set_start_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_start_sync_execution( input: &[u8], mut builder: crate::output::start_sync_execution_output::Builder, ) -> Result<crate::output::start_sync_execution_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "executionArn" => { builder = builder.set_execution_arn( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "stateMachineArn" => { builder = builder.set_state_machine_arn( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "startDate" => { builder = builder.set_start_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "stopDate" => { builder = builder.set_stop_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "status" => { builder = builder.set_status( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped().map(|u| { crate::model::SyncExecutionStatus::from(u.as_ref()) }) }) .transpose()?, ); } "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "input" => { builder = builder.set_input( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "inputDetails" => { builder = builder.set_input_details( crate::json_deser::deser_structure_cloud_watch_events_execution_data_details(tokens)? ); } "output" => { builder = builder.set_output( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "outputDetails" => { builder = builder.set_output_details( crate::json_deser::deser_structure_cloud_watch_events_execution_data_details(tokens)? ); } "traceHeader" => { builder = builder.set_trace_header( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "billingDetails" => { builder = builder.set_billing_details( crate::json_deser::deser_structure_billing_details(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_stop_execution( input: &[u8], mut builder: crate::output::stop_execution_output::Builder, ) -> Result<crate::output::stop_execution_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "stopDate" => { builder = builder.set_stop_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_structure_missing_required_parameterjson_err( input: &[u8], mut builder: crate::error::missing_required_parameter::Builder, ) -> Result<crate::error::missing_required_parameter::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "message" => { builder = builder.set_message( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn deser_operation_update_state_machine( input: &[u8], mut builder: crate::output::update_state_machine_output::Builder, ) -> Result<crate::output::update_state_machine_output::Builder, smithy_json::deserialize::Error> { let mut tokens_owned = smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(input)) .peekable(); let tokens = &mut tokens_owned; smithy_json::deserialize::token::expect_start_object(tokens.next())?; loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "updateDate" => { builder = builder.set_update_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } if tokens.next().is_some() { return Err(smithy_json::deserialize::Error::custom( "found more JSON tokens after completing parsing", )); } Ok(builder) } pub fn or_empty_doc(data: &[u8]) -> &[u8] { if data.is_empty() { b"{}" } else { data } } pub fn deser_structure_cloud_watch_events_execution_data_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<crate::model::CloudWatchEventsExecutionDataDetails>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::CloudWatchEventsExecutionDataDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "included" => { builder = builder.set_included( smithy_json::deserialize::token::expect_bool_or_null( tokens.next(), )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_logging_configuration<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::LoggingConfiguration>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::LoggingConfiguration::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "level" => { builder = builder.set_level( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::LogLevel::from(u.as_ref())) }) .transpose()?, ); } "includeExecutionData" => { builder = builder.set_include_execution_data( smithy_json::deserialize::token::expect_bool_or_null( tokens.next(), )?, ); } "destinations" => { builder = builder.set_destinations( crate::json_deser::deser_list_log_destination_list(tokens)?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_tracing_configuration<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TracingConfiguration>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TracingConfiguration::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "enabled" => { builder = builder.set_enabled( smithy_json::deserialize::token::expect_bool_or_null( tokens.next(), )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list_history_event_list<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::HistoryEvent>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_history_event(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list_activity_list<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::ActivityListItem>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_activity_list_item(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list_execution_list<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::ExecutionListItem>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_execution_list_item(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list_state_machine_list<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::vec::Vec<crate::model::StateMachineListItem>>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_state_machine_list_item(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list_tag_list<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::Tag>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_tag(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_billing_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::BillingDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::BillingDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "billedMemoryUsedInMB" => { builder = builder.set_billed_memory_used_in_mb( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i64()), ); } "billedDurationInMilliseconds" => { builder = builder.set_billed_duration_in_milliseconds( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i64()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list_log_destination_list<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::LogDestination>>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartArray { .. }) => { let mut items = Vec::new(); loop { match tokens.peek() { Some(Ok(smithy_json::deserialize::Token::EndArray { .. })) => { tokens.next().transpose().unwrap(); break; } _ => { let value = crate::json_deser::deser_structure_log_destination(tokens)?; if let Some(value) = value { items.push(value); } } } } Ok(Some(items)) } _ => Err(smithy_json::deserialize::Error::custom( "expected start array or null", )), } } pub fn deser_structure_history_event<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::HistoryEvent>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::HistoryEvent::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "timestamp" => { builder = builder.set_timestamp( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "type" => { builder = builder.set_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::HistoryEventType::from(u.as_ref()) }) }) .transpose()?, ); } "id" => { builder = builder.set_id( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i64()), ); } "previousEventId" => { builder = builder.set_previous_event_id( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i64()), ); } "activityFailedEventDetails" => { builder = builder.set_activity_failed_event_details( crate::json_deser::deser_structure_activity_failed_event_details(tokens)? ); } "activityScheduleFailedEventDetails" => { builder = builder.set_activity_schedule_failed_event_details( crate::json_deser::deser_structure_activity_schedule_failed_event_details(tokens)? ); } "activityScheduledEventDetails" => { builder = builder.set_activity_scheduled_event_details( crate::json_deser::deser_structure_activity_scheduled_event_details(tokens)? ); } "activityStartedEventDetails" => { builder = builder.set_activity_started_event_details( crate::json_deser::deser_structure_activity_started_event_details(tokens)? ); } "activitySucceededEventDetails" => { builder = builder.set_activity_succeeded_event_details( crate::json_deser::deser_structure_activity_succeeded_event_details(tokens)? ); } "activityTimedOutEventDetails" => { builder = builder.set_activity_timed_out_event_details( crate::json_deser::deser_structure_activity_timed_out_event_details(tokens)? ); } "taskFailedEventDetails" => { builder = builder.set_task_failed_event_details( crate::json_deser::deser_structure_task_failed_event_details( tokens, )?, ); } "taskScheduledEventDetails" => { builder = builder.set_task_scheduled_event_details( crate::json_deser::deser_structure_task_scheduled_event_details(tokens)? ); } "taskStartFailedEventDetails" => { builder = builder.set_task_start_failed_event_details( crate::json_deser::deser_structure_task_start_failed_event_details(tokens)? ); } "taskStartedEventDetails" => { builder = builder.set_task_started_event_details( crate::json_deser::deser_structure_task_started_event_details( tokens, )?, ); } "taskSubmitFailedEventDetails" => { builder = builder.set_task_submit_failed_event_details( crate::json_deser::deser_structure_task_submit_failed_event_details(tokens)? ); } "taskSubmittedEventDetails" => { builder = builder.set_task_submitted_event_details( crate::json_deser::deser_structure_task_submitted_event_details(tokens)? ); } "taskSucceededEventDetails" => { builder = builder.set_task_succeeded_event_details( crate::json_deser::deser_structure_task_succeeded_event_details(tokens)? ); } "taskTimedOutEventDetails" => { builder = builder.set_task_timed_out_event_details( crate::json_deser::deser_structure_task_timed_out_event_details(tokens)? ); } "executionFailedEventDetails" => { builder = builder.set_execution_failed_event_details( crate::json_deser::deser_structure_execution_failed_event_details(tokens)? ); } "executionStartedEventDetails" => { builder = builder.set_execution_started_event_details( crate::json_deser::deser_structure_execution_started_event_details(tokens)? ); } "executionSucceededEventDetails" => { builder = builder.set_execution_succeeded_event_details( crate::json_deser::deser_structure_execution_succeeded_event_details(tokens)? ); } "executionAbortedEventDetails" => { builder = builder.set_execution_aborted_event_details( crate::json_deser::deser_structure_execution_aborted_event_details(tokens)? ); } "executionTimedOutEventDetails" => { builder = builder.set_execution_timed_out_event_details( crate::json_deser::deser_structure_execution_timed_out_event_details(tokens)? ); } "mapStateStartedEventDetails" => { builder = builder.set_map_state_started_event_details( crate::json_deser::deser_structure_map_state_started_event_details(tokens)? ); } "mapIterationStartedEventDetails" => { builder = builder.set_map_iteration_started_event_details( crate::json_deser::deser_structure_map_iteration_event_details( tokens, )?, ); } "mapIterationSucceededEventDetails" => { builder = builder.set_map_iteration_succeeded_event_details( crate::json_deser::deser_structure_map_iteration_event_details( tokens, )?, ); } "mapIterationFailedEventDetails" => { builder = builder.set_map_iteration_failed_event_details( crate::json_deser::deser_structure_map_iteration_event_details( tokens, )?, ); } "mapIterationAbortedEventDetails" => { builder = builder.set_map_iteration_aborted_event_details( crate::json_deser::deser_structure_map_iteration_event_details( tokens, )?, ); } "lambdaFunctionFailedEventDetails" => { builder = builder.set_lambda_function_failed_event_details( crate::json_deser::deser_structure_lambda_function_failed_event_details(tokens)? ); } "lambdaFunctionScheduleFailedEventDetails" => { builder = builder.set_lambda_function_schedule_failed_event_details( crate::json_deser::deser_structure_lambda_function_schedule_failed_event_details(tokens)? ); } "lambdaFunctionScheduledEventDetails" => { builder = builder.set_lambda_function_scheduled_event_details( crate::json_deser::deser_structure_lambda_function_scheduled_event_details(tokens)? ); } "lambdaFunctionStartFailedEventDetails" => { builder = builder.set_lambda_function_start_failed_event_details( crate::json_deser::deser_structure_lambda_function_start_failed_event_details(tokens)? ); } "lambdaFunctionSucceededEventDetails" => { builder = builder.set_lambda_function_succeeded_event_details( crate::json_deser::deser_structure_lambda_function_succeeded_event_details(tokens)? ); } "lambdaFunctionTimedOutEventDetails" => { builder = builder.set_lambda_function_timed_out_event_details( crate::json_deser::deser_structure_lambda_function_timed_out_event_details(tokens)? ); } "stateEnteredEventDetails" => { builder = builder.set_state_entered_event_details( crate::json_deser::deser_structure_state_entered_event_details( tokens, )?, ); } "stateExitedEventDetails" => { builder = builder.set_state_exited_event_details( crate::json_deser::deser_structure_state_exited_event_details( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_activity_list_item<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ActivityListItem>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ActivityListItem::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "activityArn" => { builder = builder.set_activity_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "creationDate" => { builder = builder.set_creation_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_execution_list_item<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ExecutionListItem>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ExecutionListItem::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "executionArn" => { builder = builder.set_execution_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "stateMachineArn" => { builder = builder.set_state_machine_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "status" => { builder = builder.set_status( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ExecutionStatus::from(u.as_ref()) }) }) .transpose()?, ); } "startDate" => { builder = builder.set_start_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } "stopDate" => { builder = builder.set_stop_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_state_machine_list_item<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::StateMachineListItem>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::StateMachineListItem::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "stateMachineArn" => { builder = builder.set_state_machine_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "type" => { builder = builder.set_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::StateMachineType::from(u.as_ref()) }) }) .transpose()?, ); } "creationDate" => { builder = builder.set_creation_date( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::EpochSeconds, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_tag<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Tag>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::Tag::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "key" => { builder = builder.set_key( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "value" => { builder = builder.set_value( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_log_destination<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::LogDestination>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::LogDestination::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "cloudWatchLogsLogGroup" => { builder = builder.set_cloud_watch_logs_log_group( crate::json_deser::deser_structure_cloud_watch_logs_log_group( tokens, )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_activity_failed_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ActivityFailedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ActivityFailedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_activity_schedule_failed_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ActivityScheduleFailedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ActivityScheduleFailedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_activity_scheduled_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ActivityScheduledEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ActivityScheduledEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "resource" => { builder = builder.set_resource( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "input" => { builder = builder.set_input( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "inputDetails" => { builder = builder.set_input_details( crate::json_deser::deser_structure_history_event_execution_data_details(tokens)? ); } "timeoutInSeconds" => { builder = builder.set_timeout_in_seconds( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i64()), ); } "heartbeatInSeconds" => { builder = builder.set_heartbeat_in_seconds( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i64()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_activity_started_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ActivityStartedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ActivityStartedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "workerName" => { builder = builder.set_worker_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_activity_succeeded_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ActivitySucceededEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ActivitySucceededEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "output" => { builder = builder.set_output( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "outputDetails" => { builder = builder.set_output_details( crate::json_deser::deser_structure_history_event_execution_data_details(tokens)? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_activity_timed_out_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ActivityTimedOutEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ActivityTimedOutEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_task_failed_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TaskFailedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TaskFailedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "resourceType" => { builder = builder.set_resource_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "resource" => { builder = builder.set_resource( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_task_scheduled_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TaskScheduledEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TaskScheduledEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "resourceType" => { builder = builder.set_resource_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "resource" => { builder = builder.set_resource( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "region" => { builder = builder.set_region( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "parameters" => { builder = builder.set_parameters( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "timeoutInSeconds" => { builder = builder.set_timeout_in_seconds( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i64()), ); } "heartbeatInSeconds" => { builder = builder.set_heartbeat_in_seconds( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i64()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_task_start_failed_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TaskStartFailedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TaskStartFailedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "resourceType" => { builder = builder.set_resource_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "resource" => { builder = builder.set_resource( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_task_started_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TaskStartedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TaskStartedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "resourceType" => { builder = builder.set_resource_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "resource" => { builder = builder.set_resource( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_task_submit_failed_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TaskSubmitFailedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TaskSubmitFailedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "resourceType" => { builder = builder.set_resource_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "resource" => { builder = builder.set_resource( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_task_submitted_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TaskSubmittedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TaskSubmittedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "resourceType" => { builder = builder.set_resource_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "resource" => { builder = builder.set_resource( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "output" => { builder = builder.set_output( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "outputDetails" => { builder = builder.set_output_details( crate::json_deser::deser_structure_history_event_execution_data_details(tokens)? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_task_succeeded_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TaskSucceededEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TaskSucceededEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "resourceType" => { builder = builder.set_resource_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "resource" => { builder = builder.set_resource( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "output" => { builder = builder.set_output( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "outputDetails" => { builder = builder.set_output_details( crate::json_deser::deser_structure_history_event_execution_data_details(tokens)? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_task_timed_out_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::TaskTimedOutEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::TaskTimedOutEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "resourceType" => { builder = builder.set_resource_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "resource" => { builder = builder.set_resource( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_execution_failed_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ExecutionFailedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ExecutionFailedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_execution_started_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ExecutionStartedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ExecutionStartedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "input" => { builder = builder.set_input( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "inputDetails" => { builder = builder.set_input_details( crate::json_deser::deser_structure_history_event_execution_data_details(tokens)? ); } "roleArn" => { builder = builder.set_role_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_execution_succeeded_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ExecutionSucceededEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ExecutionSucceededEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "output" => { builder = builder.set_output( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "outputDetails" => { builder = builder.set_output_details( crate::json_deser::deser_structure_history_event_execution_data_details(tokens)? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_execution_aborted_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ExecutionAbortedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ExecutionAbortedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_execution_timed_out_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ExecutionTimedOutEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::ExecutionTimedOutEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_map_state_started_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::MapStateStartedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::MapStateStartedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "length" => { builder = builder.set_length( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_map_iteration_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::MapIterationEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::MapIterationEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "index" => { builder = builder.set_index( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i32()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_lambda_function_failed_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::LambdaFunctionFailedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::LambdaFunctionFailedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_lambda_function_schedule_failed_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<crate::model::LambdaFunctionScheduleFailedEventDetails>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::LambdaFunctionScheduleFailedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_lambda_function_scheduled_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<crate::model::LambdaFunctionScheduledEventDetails>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::LambdaFunctionScheduledEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "resource" => { builder = builder.set_resource( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "input" => { builder = builder.set_input( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "inputDetails" => { builder = builder.set_input_details( crate::json_deser::deser_structure_history_event_execution_data_details(tokens)? ); } "timeoutInSeconds" => { builder = builder.set_timeout_in_seconds( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_i64()), ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_lambda_function_start_failed_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<crate::model::LambdaFunctionStartFailedEventDetails>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::LambdaFunctionStartFailedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_lambda_function_succeeded_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<crate::model::LambdaFunctionSucceededEventDetails>, smithy_json::deserialize::Error, > where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::LambdaFunctionSucceededEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "output" => { builder = builder.set_output( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "outputDetails" => { builder = builder.set_output_details( crate::json_deser::deser_structure_history_event_execution_data_details(tokens)? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_lambda_function_timed_out_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::LambdaFunctionTimedOutEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::LambdaFunctionTimedOutEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "error" => { builder = builder.set_error( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "cause" => { builder = builder.set_cause( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_state_entered_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::StateEnteredEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::StateEnteredEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "input" => { builder = builder.set_input( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "inputDetails" => { builder = builder.set_input_details( crate::json_deser::deser_structure_history_event_execution_data_details(tokens)? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_state_exited_event_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::StateExitedEventDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::StateExitedEventDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "name" => { builder = builder.set_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "output" => { builder = builder.set_output( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "outputDetails" => { builder = builder.set_output_details( crate::json_deser::deser_structure_history_event_execution_data_details(tokens)? ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_cloud_watch_logs_log_group<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::CloudWatchLogsLogGroup>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::CloudWatchLogsLogGroup::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "logGroupArn" => { builder = builder.set_log_group_arn( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } } pub fn deser_structure_history_event_execution_data_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::HistoryEventExecutionDataDetails>, smithy_json::deserialize::Error> where I: Iterator< Item = Result<smithy_json::deserialize::Token<'a>, smithy_json::deserialize::Error>, >, { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), Some(smithy_json::deserialize::Token::StartObject { .. }) => { #[allow(unused_mut)] let mut builder = crate::model::HistoryEventExecutionDataDetails::builder(); loop { match tokens.next().transpose()? { Some(smithy_json::deserialize::Token::EndObject { .. }) => break, Some(smithy_json::deserialize::Token::ObjectKey { key, .. }) => { match key.to_unescaped()?.as_ref() { "truncated" => { builder = builder.set_truncated( smithy_json::deserialize::token::expect_bool_or_null( tokens.next(), )?, ); } _ => smithy_json::deserialize::token::skip_value(tokens)?, } } _ => { return Err(smithy_json::deserialize::Error::custom( "expected object key or end object", )) } } } Ok(Some(builder.build())) } _ => Err(smithy_json::deserialize::Error::custom( "expected start object or null", )), } }
//! An `Expression`. //! //! # Expression Rules //! ## Bitness //! We refer to the number of bits in the result of an `Expression` as its _bitness_. //! //! Expressions must always have the same bitness. For example, you cannot add an 8-bit and a //! 16-bit expression. You must extern or truncate one of these operands until the bitness //! matches. The bitness of all comparison expressions is always 1. //! //! # Expression Breakdown //! ## Terminals //! `scalar`, `constant` //! //! ## Binary Arithmetic //! `add`, `sub`, `divu`, `modu`, `divs`, `mods`, `and`, `or`, `xor`, `shl`, `shr` //! //! ## Comparison //! `cmpeq`, `cmpneq`, `cmplts`, `cmpltu` //! //! ## Extension/Truncation //! `zext`, `sext`, `trun` use std::fmt; use crate::il::*; use crate::Error; use serde::{Deserialize, Serialize}; /// An IL Expression. #[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)] pub enum Expression { Scalar(Scalar), Constant(Constant), Add(Box<Expression>, Box<Expression>), Sub(Box<Expression>, Box<Expression>), Mul(Box<Expression>, Box<Expression>), Divu(Box<Expression>, Box<Expression>), Modu(Box<Expression>, Box<Expression>), Divs(Box<Expression>, Box<Expression>), Mods(Box<Expression>, Box<Expression>), And(Box<Expression>, Box<Expression>), Or(Box<Expression>, Box<Expression>), Xor(Box<Expression>, Box<Expression>), Shl(Box<Expression>, Box<Expression>), Shr(Box<Expression>, Box<Expression>), #[cfg(feature = "il-expression-ashr")] AShr(Box<Expression>, Box<Expression>), Cmpeq(Box<Expression>, Box<Expression>), Cmpneq(Box<Expression>, Box<Expression>), Cmplts(Box<Expression>, Box<Expression>), Cmpltu(Box<Expression>, Box<Expression>), Zext(usize, Box<Expression>), Sext(usize, Box<Expression>), Trun(usize, Box<Expression>), Ite(Box<Expression>, Box<Expression>, Box<Expression>), } impl Expression { /// Return the bitness of this expression. pub fn bits(&self) -> usize { match *self { Expression::Scalar(ref scalar) => scalar.bits(), Expression::Constant(ref constant) => constant.bits(), Expression::Add(ref lhs, _) | Expression::Sub(ref lhs, _) | Expression::Mul(ref lhs, _) | Expression::Divu(ref lhs, _) | Expression::Modu(ref lhs, _) | Expression::Divs(ref lhs, _) | Expression::Mods(ref lhs, _) | Expression::And(ref lhs, _) | Expression::Or(ref lhs, _) | Expression::Xor(ref lhs, _) | Expression::Shl(ref lhs, _) | Expression::Shr(ref lhs, _) => lhs.bits(), #[cfg(feature = "il-expression-ashr")] Expression::AShr(ref lhs, _) => lhs.bits(), Expression::Cmpeq(_, _) | Expression::Cmpneq(_, _) | Expression::Cmplts(_, _) | Expression::Cmpltu(_, _) => 1, Expression::Zext(bits, _) | Expression::Sext(bits, _) | Expression::Trun(bits, _) => { bits } Expression::Ite(_, ref lhs, _) => lhs.bits(), } } /// Ensures the bits of both lhs and rhs are the same. fn ensure_sort(lhs: &Expression, rhs: &Expression) -> Result<(), Error> { if lhs.bits() != rhs.bits() { Err(Error::Sort) } else { Ok(()) } } /// Takes a closure which modifies an existing `Expression` /// /// The closure takes an expression, and returns an Option<Expression>. If /// the option is Some, that value will replace the sub expression in the /// larger expression. If closure returns None, the original sub /// expression will be used in the larger expression. fn map_to_expression<F>(&self, f: F) -> Result<Expression, Error> where F: Fn(&Expression) -> Option<Expression>, { struct Map<F> { f: F, } impl<F> Map<F> where F: Fn(&Expression) -> Option<Expression>, { fn map(&self, expression: &Expression) -> Result<Expression, Error> { Ok(if let Some(expression) = (self.f)(expression) { expression } else { match *expression { Expression::Scalar(ref scalar) => scalar.clone().into(), Expression::Constant(ref constant) => constant.clone().into(), Expression::Add(ref lhs, ref rhs) => { Expression::add(self.map(lhs)?, self.map(rhs)?)? } Expression::Sub(ref lhs, ref rhs) => { Expression::sub(self.map(lhs)?, self.map(rhs)?)? } Expression::Mul(ref lhs, ref rhs) => { Expression::mul(self.map(lhs)?, self.map(rhs)?)? } Expression::Divu(ref lhs, ref rhs) => { Expression::divu(self.map(lhs)?, self.map(rhs)?)? } Expression::Modu(ref lhs, ref rhs) => { Expression::modu(self.map(lhs)?, self.map(rhs)?)? } Expression::Divs(ref lhs, ref rhs) => { Expression::divs(self.map(lhs)?, self.map(rhs)?)? } Expression::Mods(ref lhs, ref rhs) => { Expression::mods(self.map(lhs)?, self.map(rhs)?)? } Expression::And(ref lhs, ref rhs) => { Expression::and(self.map(lhs)?, self.map(rhs)?)? } Expression::Or(ref lhs, ref rhs) => { Expression::or(self.map(lhs)?, self.map(rhs)?)? } Expression::Xor(ref lhs, ref rhs) => { Expression::xor(self.map(lhs)?, self.map(rhs)?)? } Expression::Shl(ref lhs, ref rhs) => { Expression::shl(self.map(lhs)?, self.map(rhs)?)? } Expression::Shr(ref lhs, ref rhs) => { Expression::shr(self.map(lhs)?, self.map(rhs)?)? } #[cfg(feature = "il-expression-ashr")] Expression::AShr(ref lhs, ref rhs) => { Expression::ashr(self.map(lhs)?, self.map(rhs)?)? } Expression::Cmpeq(ref lhs, ref rhs) => { Expression::cmpeq(self.map(lhs)?, self.map(rhs)?)? } Expression::Cmpneq(ref lhs, ref rhs) => { Expression::cmpneq(self.map(lhs)?, self.map(rhs)?)? } Expression::Cmpltu(ref lhs, ref rhs) => { Expression::cmpltu(self.map(lhs)?, self.map(rhs)?)? } Expression::Cmplts(ref lhs, ref rhs) => { Expression::cmplts(self.map(lhs)?, self.map(rhs)?)? } Expression::Zext(bits, ref src) => Expression::zext(bits, self.map(src)?)?, Expression::Sext(bits, ref src) => Expression::sext(bits, self.map(src)?)?, Expression::Trun(bits, ref src) => Expression::trun(bits, self.map(src)?)?, Expression::Ite(ref cond, ref then, ref else_) => { Expression::ite(self.map(cond)?, self.map(then)?, self.map(else_)?)? } } }) } } let map = Map { f }; map.map(self) } /// Return a clone of this expression, but with every occurrence of the /// given scalar replaced with the given expression pub fn replace_scalar( &self, scalar: &Scalar, expression: &Expression, ) -> Result<Expression, Error> { self.map_to_expression(|expr| { if let Expression::Scalar(ref expr_scalar) = *expr { if expr_scalar == scalar { Some(expression.clone()) } else { None } } else { None } }) } /// Return true if all terminals in this expression are Constant pub fn all_constants(&self) -> bool { match *self { Expression::Scalar(_) => false, Expression::Constant(_) => true, Expression::Add(ref lhs, ref rhs) | Expression::Sub(ref lhs, ref rhs) | Expression::Mul(ref lhs, ref rhs) | Expression::Divu(ref lhs, ref rhs) | Expression::Modu(ref lhs, ref rhs) | Expression::Divs(ref lhs, ref rhs) | Expression::Mods(ref lhs, ref rhs) | Expression::And(ref lhs, ref rhs) | Expression::Or(ref lhs, ref rhs) | Expression::Xor(ref lhs, ref rhs) | Expression::Shl(ref lhs, ref rhs) | Expression::Shr(ref lhs, ref rhs) | Expression::Cmpeq(ref lhs, ref rhs) | Expression::Cmpneq(ref lhs, ref rhs) | Expression::Cmplts(ref lhs, ref rhs) | Expression::Cmpltu(ref lhs, ref rhs) => lhs.all_constants() && rhs.all_constants(), #[cfg(feature = "il-expression-ashr")] Expression::AShr(ref lhs, ref rhs) => lhs.all_constants() && rhs.all_constants(), Expression::Zext(_, ref rhs) | Expression::Sext(_, ref rhs) | Expression::Trun(_, ref rhs) => rhs.all_constants(), Expression::Ite(ref cond, ref then, ref else_) => { cond.all_constants() && then.all_constants() && else_.all_constants() } } } /// Returns all `Scalars` used in this `Expression` pub fn scalars(&self) -> Vec<&Scalar> { let mut scalars: Vec<&Scalar> = Vec::new(); match *self { Expression::Scalar(ref scalar) => scalars.push(scalar), Expression::Constant(_) => {} Expression::Add(ref lhs, ref rhs) | Expression::Sub(ref lhs, ref rhs) | Expression::Mul(ref lhs, ref rhs) | Expression::Divu(ref lhs, ref rhs) | Expression::Modu(ref lhs, ref rhs) | Expression::Divs(ref lhs, ref rhs) | Expression::Mods(ref lhs, ref rhs) | Expression::And(ref lhs, ref rhs) | Expression::Or(ref lhs, ref rhs) | Expression::Xor(ref lhs, ref rhs) | Expression::Shl(ref lhs, ref rhs) | Expression::Shr(ref lhs, ref rhs) | Expression::Cmpeq(ref lhs, ref rhs) | Expression::Cmpneq(ref lhs, ref rhs) | Expression::Cmplts(ref lhs, ref rhs) | Expression::Cmpltu(ref lhs, ref rhs) => { scalars.append(&mut lhs.scalars()); scalars.append(&mut rhs.scalars()); } #[cfg(feature = "il-expression-ashr")] Expression::AShr(ref lhs, ref rhs) => { scalars.append(&mut lhs.scalars()); scalars.append(&mut rhs.scalars()); } Expression::Zext(_, ref rhs) | Expression::Sext(_, ref rhs) | Expression::Trun(_, ref rhs) => { scalars.append(&mut rhs.scalars()); } Expression::Ite(ref cond, ref then, ref else_) => { scalars.append(&mut cond.scalars()); scalars.append(&mut then.scalars()); scalars.append(&mut else_.scalars()); } } scalars } /// Return mutable references to all `Scalars` in this `Expression`. pub fn scalars_mut(&mut self) -> Vec<&mut Scalar> { let mut scalars: Vec<&mut Scalar> = Vec::new(); match *self { Expression::Scalar(ref mut scalar) => scalars.push(scalar), Expression::Constant(_) => {} Expression::Add(ref mut lhs, ref mut rhs) | Expression::Sub(ref mut lhs, ref mut rhs) | Expression::Mul(ref mut lhs, ref mut rhs) | Expression::Divu(ref mut lhs, ref mut rhs) | Expression::Modu(ref mut lhs, ref mut rhs) | Expression::Divs(ref mut lhs, ref mut rhs) | Expression::Mods(ref mut lhs, ref mut rhs) | Expression::And(ref mut lhs, ref mut rhs) | Expression::Or(ref mut lhs, ref mut rhs) | Expression::Xor(ref mut lhs, ref mut rhs) | Expression::Shl(ref mut lhs, ref mut rhs) | Expression::Shr(ref mut lhs, ref mut rhs) | Expression::Cmpeq(ref mut lhs, ref mut rhs) | Expression::Cmpneq(ref mut lhs, ref mut rhs) | Expression::Cmplts(ref mut lhs, ref mut rhs) | Expression::Cmpltu(ref mut lhs, ref mut rhs) => { scalars.append(&mut lhs.scalars_mut()); scalars.append(&mut rhs.scalars_mut()); } #[cfg(feature = "il-expression-ashr")] Expression::AShr(ref mut lhs, ref mut rhs) => { scalars.append(&mut lhs.scalars_mut()); scalars.append(&mut rhs.scalars_mut()); } Expression::Zext(_, ref mut rhs) | Expression::Sext(_, ref mut rhs) | Expression::Trun(_, ref mut rhs) => { scalars.append(&mut rhs.scalars_mut()); } Expression::Ite(ref mut cond, ref mut then, ref mut else_) => { scalars.append(&mut cond.scalars_mut()); scalars.append(&mut then.scalars_mut()); scalars.append(&mut else_.scalars_mut()); } } scalars } /// If this expression is a scalar, return the scalar pub fn get_scalar(&self) -> Option<&Scalar> { match *self { Expression::Scalar(ref scalar) => Some(scalar), _ => None, } } /// If this expression is a constant, return the constant pub fn get_constant(&self) -> Option<&Constant> { match *self { Expression::Constant(ref constant) => Some(constant), _ => None, } } /// Create a new `Expression` from a `Scalar`. pub fn scalar(scalar: Scalar) -> Expression { Expression::Scalar(scalar) } /// Create a new `Expression` from a `Constant`. pub fn constant(constant: Constant) -> Expression { Expression::Constant(constant) } /// Create an addition `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same #[allow(clippy::should_implement_trait)] pub fn add(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Add(Box::new(lhs), Box::new(rhs))) } /// Create a subtraction `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. #[allow(clippy::should_implement_trait)] pub fn sub(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Sub(Box::new(lhs), Box::new(rhs))) } /// Create an unsigned multiplication `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. #[allow(clippy::should_implement_trait)] pub fn mul(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Mul(Box::new(lhs), Box::new(rhs))) } /// Create an unsigned division `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. pub fn divu(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Divu(Box::new(lhs), Box::new(rhs))) } /// Create an unsigned modulus `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. pub fn modu(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Modu(Box::new(lhs), Box::new(rhs))) } /// Create a signed division `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. pub fn divs(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Divs(Box::new(lhs), Box::new(rhs))) } /// Create a signed modulus `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. pub fn mods(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Mods(Box::new(lhs), Box::new(rhs))) } /// Create a binary and `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. pub fn and(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::And(Box::new(lhs), Box::new(rhs))) } /// Create a binary or `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. pub fn or(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Or(Box::new(lhs), Box::new(rhs))) } /// Create a binary xor `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. pub fn xor(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Xor(Box::new(lhs), Box::new(rhs))) } /// Create a logical shift-left `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. #[allow(clippy::should_implement_trait)] pub fn shl(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Shl(Box::new(lhs), Box::new(rhs))) } /// Create a logical shift-right `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. #[allow(clippy::should_implement_trait)] pub fn shr(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Shr(Box::new(lhs), Box::new(rhs))) } /// Create an arithmetic shift-right `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. #[allow(clippy::should_implement_trait)] #[cfg(feature = "il-expression-ashr")] pub fn ashr(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::AShr(Box::new(lhs), Box::new(rhs))) } /// Create an arithmetic shift-right `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. #[allow(clippy::should_implement_trait)] #[cfg(not(feature = "il-expression-ashr"))] pub fn ashr(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; // Create the mask we apply if that lhs is signed let mask = Expression::shl(expr_const(1, lhs.bits()), rhs.clone())?; let mask = Expression::sub(mask, expr_const(1, lhs.bits()))?; let mask = Expression::shl( mask, Expression::sub(expr_const(lhs.bits() as u64, lhs.bits()), rhs.clone())?, )?; // Multiple the mask by the sign bit let expr = Expression::shr(lhs.clone(), expr_const(lhs.bits() as u64 - 1, lhs.bits()))?; let expr = Expression::mul(mask, expr)?; Expression::or(expr, Expression::shr(lhs, rhs)?) } /// Create an equals comparison `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. pub fn cmpeq(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Cmpeq(Box::new(lhs), Box::new(rhs))) } /// Create an not equals comparison `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. pub fn cmpneq(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Cmpneq(Box::new(lhs), Box::new(rhs))) } /// Create an unsigned less-than comparison `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. pub fn cmpltu(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Cmpltu(Box::new(lhs), Box::new(rhs))) } /// Create a signed less-than comparison `Expression`. /// # Error /// The sort of the lhs and the rhs are not the same. pub fn cmplts(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { Expression::ensure_sort(&lhs, &rhs)?; Ok(Expression::Cmplts(Box::new(lhs), Box::new(rhs))) } /// Create an expression to zero-extend src to the number of bits specified /// in bits. /// # Error /// src has more or equal number of bits than bits pub fn zext(bits: usize, src: Expression) -> Result<Expression, Error> { if src.bits() >= bits || src.bits() == 0 { return Err(Error::Sort); } Ok(Expression::Zext(bits, Box::new(src))) } /// Create an expression to sign-extend src to the number of bits specified /// # Error /// src has more or equal number of bits than bits pub fn sext(bits: usize, src: Expression) -> Result<Expression, Error> { if src.bits() >= bits || src.bits() == 0 { return Err(Error::Sort); } Ok(Expression::Sext(bits, Box::new(src))) } /// Create an expression to truncate the number of bits in src to the number /// of bits given. /// # Error /// src has less-than or equal bits than bits pub fn trun(bits: usize, src: Expression) -> Result<Expression, Error> { if src.bits() <= bits || src.bits() == 0 { return Err(Error::Sort); } Ok(Expression::Trun(bits, Box::new(src))) } /// Create an if-than-else expression /// # Error /// condition is not 1-bit, or bitness of then and else_ do not match. pub fn ite(cond: Expression, then: Expression, else_: Expression) -> Result<Expression, Error> { if cond.bits() != 1 || (then.bits() != else_.bits()) { return Err(Error::Sort); } Ok(Expression::Ite( Box::new(cond), Box::new(then), Box::new(else_), )) } /// Perform a shift-right arithmetic /// /// This is a pseudo-expression, and emits an expression with /// sub-expressions pub fn sra(lhs: Expression, rhs: Expression) -> Result<Expression, Error> { if lhs.bits() != rhs.bits() { return Err(Error::Sort); } let expr = Expression::shr(lhs.clone(), rhs.clone())?; let mask = if rhs.bits() <= 64 { Expression::shl( expr_const(0xffff_ffff_ffff_ffff, rhs.bits()), Expression::sub(expr_const(rhs.bits() as u64, rhs.bits()), rhs)?, )? } else { Expression::shl( const_(0, rhs.bits()).sub(&const_(1, rhs.bits()))?.into(), Expression::sub(expr_const(rhs.bits() as u64, rhs.bits()), rhs)?, )? }; Expression::or( expr, Expression::ite( Expression::cmplts(lhs.clone(), expr_const(0, lhs.bits()))?, mask, expr_const(0, lhs.bits()), )?, ) } /// Perform a left-rotation /// /// This is a pseudo-expression, and emits an expression with /// sub-expressions pub fn rotl(e: Expression, s: Expression) -> Result<Expression, Error> { Expression::or( Expression::shl(e.clone(), s.clone())?, Expression::shr( e.clone(), Expression::sub(expr_const(e.bits() as u64, e.bits()), s)?, )?, ) } } impl From<Scalar> for Expression { fn from(scalar: Scalar) -> Expression { Expression::Scalar(scalar) } } impl From<Constant> for Expression { fn from(constant: Constant) -> Expression { Expression::Constant(constant) } } impl fmt::Display for Expression { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { Expression::Scalar(ref s) => s.fmt(f), Expression::Constant(ref c) => c.fmt(f), Expression::Add(ref lhs, ref rhs) => write!(f, "({} + {})", lhs, rhs), Expression::Sub(ref lhs, ref rhs) => write!(f, "({} - {})", lhs, rhs), Expression::Mul(ref lhs, ref rhs) => write!(f, "({} * {})", lhs, rhs), Expression::Divu(ref lhs, ref rhs) => write!(f, "({} /u {})", lhs, rhs), Expression::Modu(ref lhs, ref rhs) => write!(f, "({} %u {})", lhs, rhs), Expression::Divs(ref lhs, ref rhs) => write!(f, "({} /s {})", lhs, rhs), Expression::Mods(ref lhs, ref rhs) => write!(f, "({} %s {})", lhs, rhs), Expression::And(ref lhs, ref rhs) => write!(f, "({} & {})", lhs, rhs), Expression::Or(ref lhs, ref rhs) => write!(f, "({} | {})", lhs, rhs), Expression::Xor(ref lhs, ref rhs) => write!(f, "({} ^ {})", lhs, rhs), Expression::Shl(ref lhs, ref rhs) => write!(f, "({} << {})", lhs, rhs), Expression::Shr(ref lhs, ref rhs) => write!(f, "({} >> {})", lhs, rhs), #[cfg(feature = "il-expression-ashr")] Expression::AShr(ref lhs, ref rhs) => write!(f, "({} >>> {})", lhs, rhs), Expression::Cmpeq(ref lhs, ref rhs) => write!(f, "({} == {})", lhs, rhs), Expression::Cmpneq(ref lhs, ref rhs) => write!(f, "({} != {})", lhs, rhs), Expression::Cmplts(ref lhs, ref rhs) => write!(f, "({} <s {})", lhs, rhs), Expression::Cmpltu(ref lhs, ref rhs) => write!(f, "({} <u {})", lhs, rhs), Expression::Zext(ref bits, ref src) => write!(f, "zext.{}({})", bits, src), Expression::Sext(ref bits, ref src) => write!(f, "sext.{}({})", bits, src), Expression::Trun(ref bits, ref src) => write!(f, "trun.{}({})", bits, src), Expression::Ite(ref cond, ref then, ref else_) => { write!(f, "ite({}, {}, {})", cond, then, else_) } } } } #[test] fn expression_tests() { let expression = Expression::add( expr_scalar("a", 32), Expression::sub(expr_scalar("b", 32), expr_const(0xdeadbeef, 32)).unwrap(), ) .unwrap(); assert!(expression.scalars().contains(&&scalar("a", 32))); assert!(expression.scalars().contains(&&scalar("b", 32))); assert!(expression .replace_scalar(&scalar("a", 32), &expr_scalar("c", 32)) .unwrap() .scalars() .contains(&&scalar("c", 32))); assert!(!expression .replace_scalar(&scalar("a", 32), &expr_scalar("c", 32)) .unwrap() .scalars() .contains(&&scalar("a", 32))); assert_eq!(expression.bits(), 32); assert!(!expression.all_constants()); }
use crate::{ Error, Result, lifecycle::{Event, Window}, }; /// The structure responsible for managing the game loop state pub trait State: 'static { /// Create the state given the window and canvas fn new() -> Result<Self> where Self: Sized; /// Tick the State forward one frame /// /// Will happen at a fixed rate of 60 ticks per second under ideal conditions. Under non-ideal conditions, /// the game loop will do its best to still call the update at about 60 TPS. /// /// By default it does nothing fn update(&mut self, _window: &mut Window) -> Result<()> { Ok(()) } /// Process an incoming event /// /// By default it does nothing fn event(&mut self, _event: &Event, _window: &mut Window) -> Result<()> { Ok(()) } /// Draw the state to the screen /// /// Will happen as often as possible, only limited by vysnc and the configured draw rate. /// /// By default it draws a black screen fn draw(&mut self, window: &mut Window) -> Result<()> { window.clear(crate::graphics::Color::BLACK)?; Ok(()) } /// Log and report an error in some way /// /// There's no way to *recover from* the error at this stage, because error handling should take /// place at the error site. However, on the web especially, logging errors can be difficult, /// so this provides a way to log other than a panic. fn handle_error(error: Error) { #[cfg(target_arch = "wasm32")] { let message = format!("Unhandled error: {:?}", error); console!(error, message); } panic!("Unhandled error: {:?}", error); } }
use sqlx::types::Json; use super::*; #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Storage { pub id: Uuid, pub name: String, pub status: Status, pub storage_type: StorageType, pub config: Json<StorageConfig>, } #[derive(Serialize, Deserialize, Debug, Clone)] pub struct NewStorage { pub name: String, pub storage_type: StorageType, pub config: StorageConfig, } #[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq, Type, EnumString, Display)] #[sqlx(rename_all = "lowercase")] #[sqlx(type_name = "varchar")] #[serde(rename_all = "lowercase")] pub enum StorageType { #[strum(serialize = "local")] Local, #[strum(serialize = "shared")] Shared, } #[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq, Type, EnumString, Display)] #[sqlx(rename_all = "lowercase")] #[sqlx(type_name = "varchar")] #[strum(serialize_all = "snake_case")] #[serde(rename_all = "lowercase")] pub enum Status { #[strum(serialize = "up")] Up, #[strum(serialize = "down")] Down, } #[derive(Deserialize, Serialize, Debug, Clone)] pub struct StorageConfig { pub host_id: Option<Uuid>, pub path: Option<String>, pub pool_name: Option<String>, } #[derive(Error, Debug)] pub enum StorageError { #[error("Couldn't list storages: '{0}'")] List(sqlx::Error), #[error("Couldn't find storage: '{0}', error: '{1}'")] Find(Uuid, sqlx::Error), #[error("Couldn't add storage '{0}', error: '{1}'")] Add(String, sqlx::Error), } pub async fn list(pool: &PgPool) -> Result<Vec<Storage>, StorageError> { let storages = sqlx::query_as!( Storage, r#" SELECT id, name, status as "status: _", storage_type as "storage_type: _", config as "config: Json<StorageConfig>" FROM storage "# ) .fetch_all(pool) .await .map_err(StorageError::List)?; Ok(storages) } pub async fn add(pool: &PgPool, storage: &NewStorage) -> Result<Uuid, StorageError> { let rec = sqlx::query!( r#" INSERT INTO storage (name, status, storage_type, config) VALUES ( $1, $2, $3, $4) RETURNING id "#, storage.name, Status::Down as Status, storage.storage_type.to_string(), Json(&storage.config) as _, ) .fetch_one(pool) .await .map_err(|e| StorageError::Add(storage.name.to_owned(), e))?; Ok(rec.id) } pub async fn by_id(pool: &PgPool, storage_id: Uuid) -> Result<Storage, StorageError> { let storage = sqlx::query_as!( Storage, r#" SELECT id, name, status as "status: _", storage_type as "storage_type: _", config as "config: Json<StorageConfig>" FROM storage WHERE id = $1 "#, storage_id ) .fetch_one(pool) .await .map_err(|e| StorageError::Find(storage_id, e))?; Ok(storage) }
use core::fmt; use core::fmt::Debug; #[derive(Clone, Copy)] pub enum XpsError { StreamNotOpened, InvalidHeader, Unknown, FileNotLoaded, PathGetParent, PathToStr, MeshReadAscii, MeshReadBin, None, } impl Default for XpsError { fn default() -> XpsError { XpsError::Unknown } } impl Debug for XpsError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { XpsError::StreamNotOpened => write!(f, "StreamNotOpened"), XpsError::InvalidHeader => write!(f, "InvalidHeader"), XpsError::FileNotLoaded => write!(f, "FileNotLoaded"), XpsError::PathGetParent => write!(f, "PathGetParent"), XpsError::PathToStr => write!(f, "PathToStr"), XpsError::MeshReadAscii => write!(f, "MeshReadAscii"), XpsError::MeshReadBin => write!(f, "MeshReadBin"), XpsError::Unknown => write!(f, "Unknown"), XpsError::None => write!(f, "None"), } } }
use std::io; use byteorder::ByteOrder; use crate::io::Buf; pub trait BufExt { fn get_uint_lenenc<T: ByteOrder>(&mut self) -> io::Result<Option<u64>>; fn get_str_lenenc<T: ByteOrder>(&mut self) -> io::Result<Option<&str>>; fn get_bytes_lenenc<T: ByteOrder>(&mut self) -> io::Result<Option<&[u8]>>; } impl BufExt for &'_ [u8] { fn get_uint_lenenc<T: ByteOrder>(&mut self) -> io::Result<Option<u64>> { Ok(match self.get_u8()? { 0xFB => None, 0xFC => Some(u64::from(self.get_u16::<T>()?)), 0xFD => Some(u64::from(self.get_u24::<T>()?)), 0xFE => Some(self.get_u64::<T>()?), value => Some(u64::from(value)), }) } fn get_str_lenenc<T: ByteOrder>(&mut self) -> io::Result<Option<&str>> { self.get_uint_lenenc::<T>()? .map(move |len| self.get_str(len as usize)) .transpose() } fn get_bytes_lenenc<T: ByteOrder>(&mut self) -> io::Result<Option<&[u8]>> { self.get_uint_lenenc::<T>()? .map(move |len| self.get_bytes(len as usize)) .transpose() } }
use std::io::Write; use nickel::status::StatusCode::{Forbidden, NotFound}; use nickel::{NickelError, Request, Action, Continue, Halt}; use session::{ServerData}; pub fn error_handler<'a>(err: &mut NickelError<ServerData>, _: &mut Request<ServerData>) -> Action { if let Some(ref mut res) = err.stream { if res.status() == Forbidden { let _ = res.write_all(b"Access denied!\n"); return Halt(()) } else if res.status() == NotFound { let _ = res.write_all(b"There is no such page\n"); return Halt(()) } } Continue(()) }
//! Tests auto-converted from "sass-spec/spec/parser/interpolate" #[allow(unused)] use super::rsass; #[allow(unused)] use rsass::precision; mod t00_concatenation; mod t01_literal; mod t02_double_quoted; mod t03_single_quoted; mod t04_space_list_quoted; mod t05_comma_list_quoted; mod t06_space_list_complex; mod t07_comma_list_complex; mod t10_escaped_backslash; // Ignoring "11_escaped_literal", not expected to work yet. mod t12_escaped_double_quoted; mod t13_escaped_single_quoted; // Ignoring "14_escapes_literal_numbers", not expected to work yet. mod t15_escapes_double_quoted_numbers; mod t16_escapes_single_quoted_numbers; // Ignoring "17_escapes_literal_lowercase", not expected to work yet. mod t18_escapes_double_quoted_lowercase; mod t19_escapes_single_quoted_lowercase; // Ignoring "20_escapes_literal_uppercase", not expected to work yet. mod t21_escapes_double_quoted_uppercase; mod t22_escapes_single_quoted_uppercase; // Ignoring "23_escapes_literal_specials", not expected to work yet. mod t24_escapes_double_quoted_specials; mod t25_escapes_single_quoted_specials; mod t26_escaped_literal_quotes; mod t27_escaped_double_quotes; mod t28_escaped_single_quotes; mod t29_binary_operation; mod t30_base_test; mod t31_schema_simple; mod t32_comma_list; mod t33_space_list; mod t34_mixed_list; mod t44_selector;
use libdeflater::{Decompressor, DecompressionError}; pub enum Blob { Raw(Vec<u8>), Zlib(Vec<u8>) } impl Blob { pub fn into_data(self) -> Vec<u8> { match self { Blob::Raw(data) => data, Blob::Zlib(compressed) => { let mut decompressor = Decompressor::new(); let mut expected_len = 4 * compressed.len(); let mut decompressed = Vec::with_capacity(expected_len); loop { decompressed.resize(expected_len, 0); match decompressor.zlib_decompress(&compressed[..], &mut decompressed[..]) { Ok(len) => { assert!(len <= decompressed.len()); decompressed.resize(len, 0); return decompressed } Err(DecompressionError::InsufficientSpace) => expected_len *= 2, Err(DecompressionError::BadData) => panic!("Bad zlib data"), } } } } } }
#[doc = "Reader of register EXTICR4"] pub type R = crate::R<u32, super::EXTICR4>; #[doc = "Writer for register EXTICR4"] pub type W = crate::W<u32, super::EXTICR4>; #[doc = "Register EXTICR4 `reset()`'s with value 0"] impl crate::ResetValue for super::EXTICR4 { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "GPIO port selection\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum EXTI0_7_A { #[doc = "0: GPIO port A selected"] PA = 0, #[doc = "1: GPIO port B selected"] PB = 1, #[doc = "2: GPIO port C selected"] PC = 2, #[doc = "3: GPIO port D selected"] PD = 3, #[doc = "5: GPIO port F selected"] PF = 5, } impl From<EXTI0_7_A> for u8 { #[inline(always)] fn from(variant: EXTI0_7_A) -> Self { variant as _ } } #[doc = "Reader of field `EXTI0_7`"] pub type EXTI0_7_R = crate::R<u8, EXTI0_7_A>; impl EXTI0_7_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, EXTI0_7_A> { use crate::Variant::*; match self.bits { 0 => Val(EXTI0_7_A::PA), 1 => Val(EXTI0_7_A::PB), 2 => Val(EXTI0_7_A::PC), 3 => Val(EXTI0_7_A::PD), 5 => Val(EXTI0_7_A::PF), i => Res(i), } } #[doc = "Checks if the value of the field is `PA`"] #[inline(always)] pub fn is_pa(&self) -> bool { *self == EXTI0_7_A::PA } #[doc = "Checks if the value of the field is `PB`"] #[inline(always)] pub fn is_pb(&self) -> bool { *self == EXTI0_7_A::PB } #[doc = "Checks if the value of the field is `PC`"] #[inline(always)] pub fn is_pc(&self) -> bool { *self == EXTI0_7_A::PC } #[doc = "Checks if the value of the field is `PD`"] #[inline(always)] pub fn is_pd(&self) -> bool { *self == EXTI0_7_A::PD } #[doc = "Checks if the value of the field is `PF`"] #[inline(always)] pub fn is_pf(&self) -> bool { *self == EXTI0_7_A::PF } } #[doc = "Write proxy for field `EXTI0_7`"] pub struct EXTI0_7_W<'a> { w: &'a mut W, } impl<'a> EXTI0_7_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: EXTI0_7_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "GPIO port A selected"] #[inline(always)] pub fn pa(self) -> &'a mut W { self.variant(EXTI0_7_A::PA) } #[doc = "GPIO port B selected"] #[inline(always)] pub fn pb(self) -> &'a mut W { self.variant(EXTI0_7_A::PB) } #[doc = "GPIO port C selected"] #[inline(always)] pub fn pc(self) -> &'a mut W { self.variant(EXTI0_7_A::PC) } #[doc = "GPIO port D selected"] #[inline(always)] pub fn pd(self) -> &'a mut W { self.variant(EXTI0_7_A::PD) } #[doc = "GPIO port F selected"] #[inline(always)] pub fn pf(self) -> &'a mut W { self.variant(EXTI0_7_A::PF) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !0xff) | ((value as u32) & 0xff); self.w } } #[doc = "GPIO port selection"] pub type EXTI8_15_A = EXTI0_7_A; #[doc = "Reader of field `EXTI8_15`"] pub type EXTI8_15_R = crate::R<u8, EXTI0_7_A>; #[doc = "Write proxy for field `EXTI8_15`"] pub struct EXTI8_15_W<'a> { w: &'a mut W, } impl<'a> EXTI8_15_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: EXTI8_15_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "GPIO port A selected"] #[inline(always)] pub fn pa(self) -> &'a mut W { self.variant(EXTI0_7_A::PA) } #[doc = "GPIO port B selected"] #[inline(always)] pub fn pb(self) -> &'a mut W { self.variant(EXTI0_7_A::PB) } #[doc = "GPIO port C selected"] #[inline(always)] pub fn pc(self) -> &'a mut W { self.variant(EXTI0_7_A::PC) } #[doc = "GPIO port D selected"] #[inline(always)] pub fn pd(self) -> &'a mut W { self.variant(EXTI0_7_A::PD) } #[doc = "GPIO port F selected"] #[inline(always)] pub fn pf(self) -> &'a mut W { self.variant(EXTI0_7_A::PF) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0xff << 8)) | (((value as u32) & 0xff) << 8); self.w } } #[doc = "GPIO port selection"] pub type EXTI16_23_A = EXTI0_7_A; #[doc = "Reader of field `EXTI16_23`"] pub type EXTI16_23_R = crate::R<u8, EXTI0_7_A>; #[doc = "Write proxy for field `EXTI16_23`"] pub struct EXTI16_23_W<'a> { w: &'a mut W, } impl<'a> EXTI16_23_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: EXTI16_23_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "GPIO port A selected"] #[inline(always)] pub fn pa(self) -> &'a mut W { self.variant(EXTI0_7_A::PA) } #[doc = "GPIO port B selected"] #[inline(always)] pub fn pb(self) -> &'a mut W { self.variant(EXTI0_7_A::PB) } #[doc = "GPIO port C selected"] #[inline(always)] pub fn pc(self) -> &'a mut W { self.variant(EXTI0_7_A::PC) } #[doc = "GPIO port D selected"] #[inline(always)] pub fn pd(self) -> &'a mut W { self.variant(EXTI0_7_A::PD) } #[doc = "GPIO port F selected"] #[inline(always)] pub fn pf(self) -> &'a mut W { self.variant(EXTI0_7_A::PF) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0xff << 16)) | (((value as u32) & 0xff) << 16); self.w } } #[doc = "GPIO port selection"] pub type EXTI24_31_A = EXTI0_7_A; #[doc = "Reader of field `EXTI24_31`"] pub type EXTI24_31_R = crate::R<u8, EXTI0_7_A>; #[doc = "Write proxy for field `EXTI24_31`"] pub struct EXTI24_31_W<'a> { w: &'a mut W, } impl<'a> EXTI24_31_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: EXTI24_31_A) -> &'a mut W { unsafe { self.bits(variant.into()) } } #[doc = "GPIO port A selected"] #[inline(always)] pub fn pa(self) -> &'a mut W { self.variant(EXTI0_7_A::PA) } #[doc = "GPIO port B selected"] #[inline(always)] pub fn pb(self) -> &'a mut W { self.variant(EXTI0_7_A::PB) } #[doc = "GPIO port C selected"] #[inline(always)] pub fn pc(self) -> &'a mut W { self.variant(EXTI0_7_A::PC) } #[doc = "GPIO port D selected"] #[inline(always)] pub fn pd(self) -> &'a mut W { self.variant(EXTI0_7_A::PD) } #[doc = "GPIO port F selected"] #[inline(always)] pub fn pf(self) -> &'a mut W { self.variant(EXTI0_7_A::PF) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0xff << 24)) | (((value as u32) & 0xff) << 24); self.w } } impl R { #[doc = "Bits 0:7 - GPIO port selection"] #[inline(always)] pub fn exti0_7(&self) -> EXTI0_7_R { EXTI0_7_R::new((self.bits & 0xff) as u8) } #[doc = "Bits 8:15 - GPIO port selection"] #[inline(always)] pub fn exti8_15(&self) -> EXTI8_15_R { EXTI8_15_R::new(((self.bits >> 8) & 0xff) as u8) } #[doc = "Bits 16:23 - GPIO port selection"] #[inline(always)] pub fn exti16_23(&self) -> EXTI16_23_R { EXTI16_23_R::new(((self.bits >> 16) & 0xff) as u8) } #[doc = "Bits 24:31 - GPIO port selection"] #[inline(always)] pub fn exti24_31(&self) -> EXTI24_31_R { EXTI24_31_R::new(((self.bits >> 24) & 0xff) as u8) } } impl W { #[doc = "Bits 0:7 - GPIO port selection"] #[inline(always)] pub fn exti0_7(&mut self) -> EXTI0_7_W { EXTI0_7_W { w: self } } #[doc = "Bits 8:15 - GPIO port selection"] #[inline(always)] pub fn exti8_15(&mut self) -> EXTI8_15_W { EXTI8_15_W { w: self } } #[doc = "Bits 16:23 - GPIO port selection"] #[inline(always)] pub fn exti16_23(&mut self) -> EXTI16_23_W { EXTI16_23_W { w: self } } #[doc = "Bits 24:31 - GPIO port selection"] #[inline(always)] pub fn exti24_31(&mut self) -> EXTI24_31_W { EXTI24_31_W { w: self } } }
mod asm; mod direction; mod disasm; mod interpret; mod op; pub use crate::asm::*; pub use crate::direction::*; pub use crate::disasm::*; pub use crate::interpret::*; pub use crate::op::*;
use icell::scoped::{self, ICell}; fn main() { scoped::owner!(foo); scoped::owner!(bar); let value = ICell::new(10); foo.read(&value); bar.read(&value); }