text
stringlengths
8
4.13M
#[macro_use] pub use bincode::{serialize, deserialize}; #[derive(Serialize, Deserialize, PartialEq, Debug)] pub enum Packet<'a> { Join{nickname: &'a str, }, JoinResult {success: bool,}, Chat { msg: &'a str, }, }
// SPDX-License-Identifier: MIT // Copyright (c) 2021-2022 brainpower <brainpower at mailbox dot org> #![feature(assert_matches)] #[cfg(test)] mod tests { use checkarg::{CheckArg, ValueType, RC}; use std::assert_matches::assert_matches; #[test] fn general_usage() { let argv = vec!["/test08"]; let mut ca = CheckArg::new("test08"); ca.add_autohelp(); ca.add('z', "ag", "auto-generated name", ValueType::Required, None); ca.add('y', "ng", "no value name", ValueType::Required, Some("")); ca.add( 'i', "input", "file to read from", ValueType::Required, Some("IPT"), ); ca.add('a', "alpha", "alpha option", ValueType::Required, Some("A")); ca.add_long("beta", "beta option", ValueType::Required, Some("B")); ca.add_cb( 'c', "gamma", "gamma option", |_ca, _k, _v| Ok(()), ValueType::Required, Some("C"), ); ca.add_long_cb( "delta", "delta option", |_ca, _k, _v| Ok(()), ValueType::Required, Some("D"), ); let rc = ca.parse(&argv); assert_matches!(rc, RC::Ok, "parsing failed"); assert_eq!( ca.autohelp(), "\ Usage: test08 [options] Options: -z, --ag=AG auto-generated name -a, --alpha=A alpha option --beta=B beta option --delta=D delta option -c, --gamma=C gamma option -h, --help show this help message and exit -i, --input=IPT file to read from -y, --ng no value name\n" ); } }
// #[cfg(not(debug_assertion))] // pub const IMAGE_PATH: &'static str = "/usr/share/k_config_session/assets/images"; // #[cfg(debug_assertion)] pub const IMAGE_PATH: &'static str = "k_config_session/assets/images";
use std::cmp::Ordering; use std::sync::{Arc, RwLock}; #[cfg(feature = "notify")] use notify_rust::Notification; use rand::prelude::*; use strum_macros::Display; use crate::playable::Playable; use crate::spotify::Spotify; #[derive(Display, Clone, Copy, PartialEq, Debug, Serialize, Deserialize)] pub enum RepeatSetting { None, RepeatPlaylist, RepeatTrack, } pub struct Queue { pub queue: Arc<RwLock<Vec<Playable>>>, random_order: RwLock<Option<Vec<usize>>>, current_track: RwLock<Option<usize>>, repeat: RwLock<RepeatSetting>, spotify: Arc<Spotify>, } impl Queue { pub fn new(spotify: Arc<Spotify>) -> Queue { let q = Queue { queue: Arc::new(RwLock::new(Vec::new())), spotify, current_track: RwLock::new(None), repeat: RwLock::new(RepeatSetting::None), random_order: RwLock::new(None), }; q.set_repeat(q.spotify.repeat); q.set_shuffle(q.spotify.shuffle); q } pub fn next_index(&self) -> Option<usize> { match *self.current_track.read().unwrap() { Some(mut index) => { let random_order = self.random_order.read().unwrap(); if let Some(order) = random_order.as_ref() { index = order.iter().position(|&i| i == index).unwrap(); } let mut next_index = index + 1; if next_index < self.queue.read().unwrap().len() { if let Some(order) = random_order.as_ref() { next_index = order[next_index]; } Some(next_index) } else { None } } None => None, } } pub fn previous_index(&self) -> Option<usize> { match *self.current_track.read().unwrap() { Some(mut index) => { let random_order = self.random_order.read().unwrap(); if let Some(order) = random_order.as_ref() { index = order.iter().position(|&i| i == index).unwrap(); } if index > 0 { let mut next_index = index - 1; if let Some(order) = random_order.as_ref() { next_index = order[next_index]; } Some(next_index) } else { None } } None => None, } } pub fn get_current(&self) -> Option<Playable> { match self.get_current_index() { Some(index) => Some(self.queue.read().unwrap()[index].clone()), None => None, } } pub fn get_current_index(&self) -> Option<usize> { *self.current_track.read().unwrap() } pub fn append(&self, track: Playable) { let mut random_order = self.random_order.write().unwrap(); if let Some(order) = random_order.as_mut() { let index = order.len().saturating_sub(1); order.push(index); } let mut q = self.queue.write().unwrap(); q.push(track); } pub fn append_next(&self, tracks: Vec<Playable>) -> usize { let mut q = self.queue.write().unwrap(); { let mut random_order = self.random_order.write().unwrap(); if let Some(order) = random_order.as_mut() { order.extend((q.len().saturating_sub(1))..(q.len() + tracks.len())); } } let first = match *self.current_track.read().unwrap() { Some(index) => index + 1, None => q.len(), }; let mut i = first; for track in tracks { q.insert(i, track.clone()); i += 1; } first } pub fn remove(&self, index: usize) { { let mut q = self.queue.write().unwrap(); if q.len() == 0 { info!("queue is empty"); return; } q.remove(index); } // if the queue is empty stop playback let len = self.queue.read().unwrap().len(); if len == 0 { self.stop(); return; } // if we are deleting the currently playing track, play the track with // the same index again, because the next track is now at the position // of the one we deleted let current = *self.current_track.read().unwrap(); if let Some(current_track) = current { match current_track.cmp(&index) { Ordering::Equal => { // stop playback if we have the deleted the last item and it // was playing if current_track == len { self.stop(); } else { self.play(index, false, false); } } Ordering::Greater => { let mut current = self.current_track.write().unwrap(); current.replace(current_track - 1); } _ => (), } } if self.get_shuffle() { self.generate_random_order(); } } pub fn clear(&self) { self.stop(); let mut q = self.queue.write().unwrap(); q.clear(); let mut random_order = self.random_order.write().unwrap(); if let Some(o) = random_order.as_mut() { o.clear() } } pub fn len(&self) -> usize { self.queue.read().unwrap().len() } pub fn shift(&self, from: usize, to: usize) { let mut queue = self.queue.write().unwrap(); let item = queue.remove(from); queue.insert(to, item); // if the currently playing track is affected by the shift, update its // index let mut current = self.current_track.write().unwrap(); if let Some(index) = *current { if index == from { current.replace(to); } else if index == to && from > index { current.replace(to + 1); } else if index == to && from < index { current.replace(to - 1); } } } pub fn play(&self, mut index: usize, reshuffle: bool, shuffle_index: bool) { if shuffle_index && self.get_shuffle() { let mut rng = rand::thread_rng(); index = rng.gen_range(0, &self.queue.read().unwrap().len()); } if let Some(track) = &self.queue.read().unwrap().get(index) { self.spotify.load(&track); let mut current = self.current_track.write().unwrap(); current.replace(index); self.spotify.update_track(); if self.spotify.cfg.notify.unwrap_or(false) { #[cfg(feature = "notify")] if let Err(e) = Notification::new().summary(&track.to_string()).show() { error!("error showing notification: {:?}", e); } } } if reshuffle && self.get_shuffle() { self.generate_random_order() } } pub fn toggleplayback(&self) { self.spotify.toggleplayback(); } pub fn stop(&self) { let mut current = self.current_track.write().unwrap(); *current = None; self.spotify.stop(); } pub fn next(&self, manual: bool) { let q = self.queue.read().unwrap(); let current = *self.current_track.read().unwrap(); let repeat = *self.repeat.read().unwrap(); if repeat == RepeatSetting::RepeatTrack && !manual { if let Some(index) = current { self.play(index, false, false); } } else if let Some(index) = self.next_index() { self.play(index, false, false); } else if repeat == RepeatSetting::RepeatPlaylist && q.len() > 0 { let random_order = self.random_order.read().unwrap(); self.play( random_order.as_ref().map(|o| o[0]).unwrap_or(0), false, false, ); } else { self.spotify.stop(); } } pub fn previous(&self) { if let Some(index) = self.previous_index() { self.play(index, false, false); } else { self.spotify.stop(); } } pub fn get_repeat(&self) -> RepeatSetting { let repeat = self.repeat.read().unwrap(); *repeat } pub fn set_repeat(&self, new: RepeatSetting) { let mut repeat = self.repeat.write().unwrap(); *repeat = new; } pub fn get_shuffle(&self) -> bool { let random_order = self.random_order.read().unwrap(); random_order.is_some() } fn generate_random_order(&self) { let q = self.queue.read().unwrap(); let mut order: Vec<usize> = Vec::with_capacity(q.len()); let mut random: Vec<usize> = (0..q.len()).collect(); if let Some(current) = *self.current_track.read().unwrap() { order.push(current); random.remove(current); } let mut rng = rand::thread_rng(); random.shuffle(&mut rng); order.extend(random); let mut random_order = self.random_order.write().unwrap(); *random_order = Some(order); } pub fn set_shuffle(&self, new: bool) { if new { self.generate_random_order(); } else { let mut random_order = self.random_order.write().unwrap(); *random_order = None; } } pub fn get_spotify(&self) -> Arc<Spotify> { self.spotify.clone() } }
use std::env; use std::fs; use std::time::Instant; #[derive(Debug)] enum PwdPolicyKind { Old, New } #[derive(Debug)] struct PwdPolicy { kind: PwdPolicyKind, letter: String, left: usize, right: usize, } #[derive(Debug)] struct PwdValidator { policy: PwdPolicy, password: String } impl PwdValidator { fn create_policy(kind: PwdPolicyKind, policy: String, password: String) -> PwdValidator { // policy is of like "2-8 q" let left_right_char: Vec<&str> = policy.split_whitespace().collect(); let left_right: Vec<usize> = left_right_char[0].split("-").map(|i| i.parse().expect("parse error")).collect(); let ch = left_right_char[1]; let policy = PwdPolicy { kind, letter: ch.to_string(), left: left_right[0], right: left_right[1] }; // return the object created below PwdValidator { policy, password } } fn is_valid(&self) -> bool { match self.policy.kind { PwdPolicyKind::Old => self._is_valid_old_pol(), PwdPolicyKind::New => self._is_valid_new_pol() } } fn _is_valid_old_pol(&self) -> bool { let cnt = self.password.matches(&self.policy.letter).count(); return if cnt < self.policy.left || cnt > self.policy.right { false } else { true } } fn _is_valid_new_pol(&self) -> bool { let l_char = self.password.chars().nth(self.policy.left - 1).unwrap(); let r_char = self.password.chars().nth(self.policy.right - 1).unwrap(); let is_left_ok : bool = l_char.to_string() == self.policy.letter; let is_right_ok : bool = r_char.to_string() == self.policy.letter; is_left_ok ^ is_right_ok // ^ is a XOR operator } } fn main() { let args: Vec<String> = env::args().collect(); let filename = &args[1]; let start = Instant::now(); let contents = fs::read_to_string(filename).expect("Something went wrong reading the file"); let mut old_pol_valid_cnt = 0; let mut new_pol_valid_cnt = 0; for line in contents.lines() { let policy_pwd: Vec<&str> = line.split(":").collect(); let password_old_pol = PwdValidator::create_policy(PwdPolicyKind::Old, policy_pwd[0].to_string(), policy_pwd[1].trim_start().to_string()); let password_new_pol = PwdValidator::create_policy(PwdPolicyKind::New, policy_pwd[0].to_string(), policy_pwd[1].trim_start().to_string()); //println!{"{:?}", password}; if password_old_pol.is_valid() { old_pol_valid_cnt += 1; } if password_new_pol.is_valid() { new_pol_valid_cnt += 1; } } println!("Valid password according to *OLD* policy = {}", old_pol_valid_cnt); println!("Valid password according to *NEW* policy = {}", new_pol_valid_cnt); let duration = start.elapsed(); println!("Finished after {:?}", duration); }
use game::*; use std::marker::PhantomData; pub type CostType=f64; pub trait Node<Result, State>: Sized + Clone{ fn neighbours(&self, &Game1, &mut State)->Vec<Self>; fn reach_cost(&self)->CostType; fn estimate(&self, &Self)->CostType; fn is_same(&self, &Self)->bool; fn make_path(&self)->Result; } pub struct PathfindingState<T1, State, T: Node<T1, State>>{ pub open_nodes: Vec<T>, pub phantom: PhantomData<T1>, pub phantom_state: PhantomData<State>, pub closed_nodes: Vec<T>, } pub struct PathfindingSettings{ pub max_iterations: usize } #[derive(Clone, Debug)] pub struct BasicNode{ pub parent: Option<Box<BasicNode>>, pub cost: CostType, pub x: i64, pub y: i64 }
use super::{ImVec2, ImVec4}; use std::os::raw::c_void; use texture_cache::TextureID; use sys; /// Represent an image about to be drawn /// See [`Ui::image`]. /// /// Create your image using the builder pattern then [`Image::build`] it. pub struct Image<E> { /// we use Result to allow postponing any construction errors to the build call texture_id: Result<TextureID, E>, size: ImVec2, uv0: ImVec2, uv1: ImVec2, tint_col: ImVec4, border_col: ImVec4, } impl<E> Image<E> { pub fn new<S>(texture: Result<TextureID, E>, size: S) -> Image<E> where S: Into<ImVec2>, { const DEFAULT_UV0: ImVec2 = ImVec2 { x: 0.0, y: 0.0 }; const DEFAULT_UV1: ImVec2 = ImVec2 { x: 1.0, y: 1.0 }; const DEFAULT_TINT_COL: ImVec4 = ImVec4 { x: 1.0, y: 1.0, z: 1.0, w: 1.0, }; const DEFAULT_BORDER_COL: ImVec4 = ImVec4 { x: 0.0, y: 0.0, z: 0.0, w: 0.0, }; Image { texture_id: texture, size: size.into(), uv0: DEFAULT_UV0, uv1: DEFAULT_UV1, tint_col: DEFAULT_TINT_COL, border_col: DEFAULT_BORDER_COL, } } /// Set uv0 (default `[0.0, 0.0]`) pub fn uv0<T: Into<ImVec2>>(mut self, uv0: T) -> Self { self.uv0 = uv0.into(); self } /// Set uv1 (default `[1.0, 1.0]`) pub fn uv1<T: Into<ImVec2>>(mut self, uv1: T) -> Self { self.uv1 = uv1.into(); self } /// Set tint color (default: no tint color) pub fn tint_col<T: Into<ImVec4>>(mut self, tint_col: T) -> Self { self.tint_col = tint_col.into(); self } /// Set border color (default: no border) pub fn border_col<T: Into<ImVec4>>(mut self, border_col: T) -> Self { self.border_col = border_col.into(); self } /// Draw image where the cursor currently is /// here we can finally bubble up the error pub fn build(self) -> Result<(), E> { let id = self.texture_id?; unsafe { sys::igImage( id as *mut c_void, self.size, self.uv0, self.uv1, self.tint_col, self.border_col, ); } Ok(()) } }
// 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 super::super::arch::x86_64::context::*; use super::super::qlib::addr::*; pub type MmapDirection = i32; pub const MMAP_BOTTOM_UP: MmapDirection = 0; pub const MMAP_TOP_DOWN: MmapDirection = 1; // MmapLayout defines the layout of the user address space for a particular // MemoryManager. // // Note that "highest address" below is always exclusive. #[derive(Debug, Copy, Clone, Default)] pub struct MmapLayout { // MinAddr is the lowest mappable address. pub MinAddr: u64, // MaxAddr is the highest mappable address. pub MaxAddr: u64, // BottomUpBase is the lowest address that may be returned for a // MmapBottomUp mmap. pub BottomUpBase: u64, // TopDownBase is the highest address that may be returned for a // MmapTopDown mmap. pub TopDownBase: u64, // DefaultDirection is the direction for most non-fixed mmaps in this // layout. pub DefaultDirection: MmapDirection, // MaxStackRand is the maximum randomization to apply to stack // allocations to maintain a proper gap between the stack and // TopDownBase. pub MaxStackRand: u64, pub sharedLoadsOffset: u64, } impl MmapLayout { // Valid returns true if this layout is valid. pub fn Valid(&self) -> bool { if self.MinAddr > self.MaxAddr { return false; } if self.BottomUpBase < self.MinAddr { return false; } if self.BottomUpBase > self.MaxAddr { return false; } if self.TopDownBase < self.MinAddr { return false; } if self.TopDownBase > self.MaxAddr { return false; } return true; } pub fn MapStackAddr(&self) -> u64 { return Addr(self.MaxAddr - MMapRand(self.MaxStackRand).expect("MapStackAddr fail")).RoundDown().unwrap().0; } }
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} #[repr(transparent)] pub struct ActivationKind(pub i32); impl ActivationKind { pub const Launch: Self = Self(0i32); pub const Search: Self = Self(1i32); pub const ShareTarget: Self = Self(2i32); pub const File: Self = Self(3i32); pub const Protocol: Self = Self(4i32); pub const FileOpenPicker: Self = Self(5i32); pub const FileSavePicker: Self = Self(6i32); pub const CachedFileUpdater: Self = Self(7i32); pub const ContactPicker: Self = Self(8i32); pub const Device: Self = Self(9i32); pub const PrintTaskSettings: Self = Self(10i32); pub const CameraSettings: Self = Self(11i32); pub const RestrictedLaunch: Self = Self(12i32); pub const AppointmentsProvider: Self = Self(13i32); pub const Contact: Self = Self(14i32); pub const LockScreenCall: Self = Self(15i32); pub const VoiceCommand: Self = Self(16i32); pub const LockScreen: Self = Self(17i32); pub const PickerReturned: Self = Self(1000i32); pub const WalletAction: Self = Self(1001i32); pub const PickFileContinuation: Self = Self(1002i32); pub const PickSaveFileContinuation: Self = Self(1003i32); pub const PickFolderContinuation: Self = Self(1004i32); pub const WebAuthenticationBrokerContinuation: Self = Self(1005i32); pub const WebAccountProvider: Self = Self(1006i32); pub const ComponentUI: Self = Self(1007i32); pub const ProtocolForResults: Self = Self(1009i32); pub const ToastNotification: Self = Self(1010i32); pub const Print3DWorkflow: Self = Self(1011i32); pub const DialReceiver: Self = Self(1012i32); pub const DevicePairing: Self = Self(1013i32); pub const UserDataAccountsProvider: Self = Self(1014i32); pub const FilePickerExperience: Self = Self(1015i32); pub const LockScreenComponent: Self = Self(1016i32); pub const ContactPanel: Self = Self(1017i32); pub const PrintWorkflowForegroundTask: Self = Self(1018i32); pub const GameUIProvider: Self = Self(1019i32); pub const StartupTask: Self = Self(1020i32); pub const CommandLineLaunch: Self = Self(1021i32); pub const BarcodeScannerProvider: Self = Self(1022i32); pub const PrintSupportJobUI: Self = Self(1023i32); pub const PrintSupportSettingsUI: Self = Self(1024i32); pub const PhoneCallActivation: Self = Self(1025i32); pub const VpnForeground: Self = Self(1026i32); } impl ::core::marker::Copy for ActivationKind {} impl ::core::clone::Clone for ActivationKind { fn clone(&self) -> Self { *self } } #[repr(transparent)] pub struct ApplicationExecutionState(pub i32); impl ApplicationExecutionState { pub const NotRunning: Self = Self(0i32); pub const Running: Self = Self(1i32); pub const Suspended: Self = Self(2i32); pub const Terminated: Self = Self(3i32); pub const ClosedByUser: Self = Self(4i32); } impl ::core::marker::Copy for ApplicationExecutionState {} impl ::core::clone::Clone for ApplicationExecutionState { fn clone(&self) -> Self { *self } } pub type AppointmentsProviderAddAppointmentActivatedEventArgs = *mut ::core::ffi::c_void; pub type AppointmentsProviderRemoveAppointmentActivatedEventArgs = *mut ::core::ffi::c_void; pub type AppointmentsProviderReplaceAppointmentActivatedEventArgs = *mut ::core::ffi::c_void; pub type AppointmentsProviderShowAppointmentDetailsActivatedEventArgs = *mut ::core::ffi::c_void; pub type AppointmentsProviderShowTimeFrameActivatedEventArgs = *mut ::core::ffi::c_void; pub type BackgroundActivatedEventArgs = *mut ::core::ffi::c_void; pub type BarcodeScannerPreviewActivatedEventArgs = *mut ::core::ffi::c_void; pub type CachedFileUpdaterActivatedEventArgs = *mut ::core::ffi::c_void; pub type CameraSettingsActivatedEventArgs = *mut ::core::ffi::c_void; pub type CommandLineActivatedEventArgs = *mut ::core::ffi::c_void; pub type CommandLineActivationOperation = *mut ::core::ffi::c_void; pub type ContactCallActivatedEventArgs = *mut ::core::ffi::c_void; pub type ContactMapActivatedEventArgs = *mut ::core::ffi::c_void; pub type ContactMessageActivatedEventArgs = *mut ::core::ffi::c_void; pub type ContactPanelActivatedEventArgs = *mut ::core::ffi::c_void; pub type ContactPickerActivatedEventArgs = *mut ::core::ffi::c_void; pub type ContactPostActivatedEventArgs = *mut ::core::ffi::c_void; pub type ContactVideoCallActivatedEventArgs = *mut ::core::ffi::c_void; pub type DeviceActivatedEventArgs = *mut ::core::ffi::c_void; pub type DevicePairingActivatedEventArgs = *mut ::core::ffi::c_void; pub type DialReceiverActivatedEventArgs = *mut ::core::ffi::c_void; pub type FileActivatedEventArgs = *mut ::core::ffi::c_void; pub type FileOpenPickerActivatedEventArgs = *mut ::core::ffi::c_void; pub type FileOpenPickerContinuationEventArgs = *mut ::core::ffi::c_void; pub type FileSavePickerActivatedEventArgs = *mut ::core::ffi::c_void; pub type FileSavePickerContinuationEventArgs = *mut ::core::ffi::c_void; pub type FolderPickerContinuationEventArgs = *mut ::core::ffi::c_void; pub type IActivatedEventArgs = *mut ::core::ffi::c_void; pub type IActivatedEventArgsWithUser = *mut ::core::ffi::c_void; pub type IApplicationViewActivatedEventArgs = *mut ::core::ffi::c_void; pub type IAppointmentsProviderActivatedEventArgs = *mut ::core::ffi::c_void; pub type IAppointmentsProviderAddAppointmentActivatedEventArgs = *mut ::core::ffi::c_void; pub type IAppointmentsProviderRemoveAppointmentActivatedEventArgs = *mut ::core::ffi::c_void; pub type IAppointmentsProviderReplaceAppointmentActivatedEventArgs = *mut ::core::ffi::c_void; pub type IAppointmentsProviderShowAppointmentDetailsActivatedEventArgs = *mut ::core::ffi::c_void; pub type IAppointmentsProviderShowTimeFrameActivatedEventArgs = *mut ::core::ffi::c_void; pub type IBackgroundActivatedEventArgs = *mut ::core::ffi::c_void; pub type IBarcodeScannerPreviewActivatedEventArgs = *mut ::core::ffi::c_void; pub type ICachedFileUpdaterActivatedEventArgs = *mut ::core::ffi::c_void; pub type ICameraSettingsActivatedEventArgs = *mut ::core::ffi::c_void; pub type ICommandLineActivatedEventArgs = *mut ::core::ffi::c_void; pub type IContactActivatedEventArgs = *mut ::core::ffi::c_void; pub type IContactCallActivatedEventArgs = *mut ::core::ffi::c_void; pub type IContactMapActivatedEventArgs = *mut ::core::ffi::c_void; pub type IContactMessageActivatedEventArgs = *mut ::core::ffi::c_void; pub type IContactPanelActivatedEventArgs = *mut ::core::ffi::c_void; pub type IContactPickerActivatedEventArgs = *mut ::core::ffi::c_void; pub type IContactPostActivatedEventArgs = *mut ::core::ffi::c_void; pub type IContactVideoCallActivatedEventArgs = *mut ::core::ffi::c_void; pub type IContactsProviderActivatedEventArgs = *mut ::core::ffi::c_void; pub type IContinuationActivatedEventArgs = *mut ::core::ffi::c_void; pub type IDeviceActivatedEventArgs = *mut ::core::ffi::c_void; pub type IDevicePairingActivatedEventArgs = *mut ::core::ffi::c_void; pub type IDialReceiverActivatedEventArgs = *mut ::core::ffi::c_void; pub type IFileActivatedEventArgs = *mut ::core::ffi::c_void; pub type IFileActivatedEventArgsWithCallerPackageFamilyName = *mut ::core::ffi::c_void; pub type IFileActivatedEventArgsWithNeighboringFiles = *mut ::core::ffi::c_void; pub type IFileOpenPickerActivatedEventArgs = *mut ::core::ffi::c_void; pub type IFileOpenPickerActivatedEventArgs2 = *mut ::core::ffi::c_void; pub type IFileOpenPickerContinuationEventArgs = *mut ::core::ffi::c_void; pub type IFileSavePickerActivatedEventArgs = *mut ::core::ffi::c_void; pub type IFileSavePickerActivatedEventArgs2 = *mut ::core::ffi::c_void; pub type IFileSavePickerContinuationEventArgs = *mut ::core::ffi::c_void; pub type IFolderPickerContinuationEventArgs = *mut ::core::ffi::c_void; pub type ILaunchActivatedEventArgs = *mut ::core::ffi::c_void; pub type ILaunchActivatedEventArgs2 = *mut ::core::ffi::c_void; pub type ILockScreenActivatedEventArgs = *mut ::core::ffi::c_void; pub type ILockScreenCallActivatedEventArgs = *mut ::core::ffi::c_void; pub type IPhoneCallActivatedEventArgs = *mut ::core::ffi::c_void; pub type IPickerReturnedActivatedEventArgs = *mut ::core::ffi::c_void; pub type IPrelaunchActivatedEventArgs = *mut ::core::ffi::c_void; pub type IPrint3DWorkflowActivatedEventArgs = *mut ::core::ffi::c_void; pub type IPrintTaskSettingsActivatedEventArgs = *mut ::core::ffi::c_void; pub type IProtocolActivatedEventArgs = *mut ::core::ffi::c_void; pub type IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData = *mut ::core::ffi::c_void; pub type IProtocolForResultsActivatedEventArgs = *mut ::core::ffi::c_void; pub type IRestrictedLaunchActivatedEventArgs = *mut ::core::ffi::c_void; pub type ISearchActivatedEventArgs = *mut ::core::ffi::c_void; pub type ISearchActivatedEventArgsWithLinguisticDetails = *mut ::core::ffi::c_void; pub type IShareTargetActivatedEventArgs = *mut ::core::ffi::c_void; pub type IStartupTaskActivatedEventArgs = *mut ::core::ffi::c_void; pub type IToastNotificationActivatedEventArgs = *mut ::core::ffi::c_void; pub type IUserDataAccountProviderActivatedEventArgs = *mut ::core::ffi::c_void; pub type IViewSwitcherProvider = *mut ::core::ffi::c_void; pub type IVoiceCommandActivatedEventArgs = *mut ::core::ffi::c_void; pub type IWalletActionActivatedEventArgs = *mut ::core::ffi::c_void; pub type IWebAccountProviderActivatedEventArgs = *mut ::core::ffi::c_void; pub type IWebAuthenticationBrokerContinuationEventArgs = *mut ::core::ffi::c_void; pub type LaunchActivatedEventArgs = *mut ::core::ffi::c_void; pub type LockScreenActivatedEventArgs = *mut ::core::ffi::c_void; pub type LockScreenCallActivatedEventArgs = *mut ::core::ffi::c_void; pub type LockScreenComponentActivatedEventArgs = *mut ::core::ffi::c_void; pub type PhoneCallActivatedEventArgs = *mut ::core::ffi::c_void; pub type PickerReturnedActivatedEventArgs = *mut ::core::ffi::c_void; pub type Print3DWorkflowActivatedEventArgs = *mut ::core::ffi::c_void; pub type PrintTaskSettingsActivatedEventArgs = *mut ::core::ffi::c_void; pub type ProtocolActivatedEventArgs = *mut ::core::ffi::c_void; pub type ProtocolForResultsActivatedEventArgs = *mut ::core::ffi::c_void; pub type RestrictedLaunchActivatedEventArgs = *mut ::core::ffi::c_void; pub type SearchActivatedEventArgs = *mut ::core::ffi::c_void; pub type ShareTargetActivatedEventArgs = *mut ::core::ffi::c_void; pub type SplashScreen = *mut ::core::ffi::c_void; pub type StartupTaskActivatedEventArgs = *mut ::core::ffi::c_void; pub type TileActivatedInfo = *mut ::core::ffi::c_void; pub type ToastNotificationActivatedEventArgs = *mut ::core::ffi::c_void; pub type UserDataAccountProviderActivatedEventArgs = *mut ::core::ffi::c_void; pub type VoiceCommandActivatedEventArgs = *mut ::core::ffi::c_void; pub type WalletActionActivatedEventArgs = *mut ::core::ffi::c_void; pub type WebAccountProviderActivatedEventArgs = *mut ::core::ffi::c_void; pub type WebAuthenticationBrokerContinuationEventArgs = *mut ::core::ffi::c_void;
#![warn(rust_2018_idioms)] use slab::*; use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe}; #[test] fn insert_get_remove_one() { let mut slab = Slab::new(); assert!(slab.is_empty()); let key = slab.insert(10); assert_eq!(slab[key], 10); assert_eq!(slab.get(key), Some(&10)); assert!(!slab.is_empty()); assert!(slab.contains(key)); assert_eq!(slab.remove(key), 10); assert!(!slab.contains(key)); assert!(slab.get(key).is_none()); } #[test] fn insert_get_many() { let mut slab = Slab::with_capacity(10); for i in 0..10 { let key = slab.insert(i + 10); assert_eq!(slab[key], i + 10); } assert_eq!(slab.capacity(), 10); // Storing another one grows the slab let key = slab.insert(20); assert_eq!(slab[key], 20); // Capacity grows by 2x assert_eq!(slab.capacity(), 20); } #[test] fn insert_get_remove_many() { let mut slab = Slab::with_capacity(10); let mut keys = vec![]; for i in 0..10 { for j in 0..10 { let val = (i * 10) + j; let key = slab.insert(val); keys.push((key, val)); assert_eq!(slab[key], val); } for (key, val) in keys.drain(..) { assert_eq!(val, slab.remove(key)); } } assert_eq!(10, slab.capacity()); } #[test] fn insert_with_vacant_entry() { let mut slab = Slab::with_capacity(1); let key; { let entry = slab.vacant_entry(); key = entry.key(); entry.insert(123); } assert_eq!(123, slab[key]); } #[test] fn get_vacant_entry_without_using() { let mut slab = Slab::<usize>::with_capacity(1); let key = slab.vacant_entry().key(); assert_eq!(key, slab.vacant_entry().key()); } #[test] #[should_panic(expected = "invalid key")] fn invalid_get_panics() { let slab = Slab::<usize>::with_capacity(1); let _ = &slab[0]; } #[test] #[should_panic(expected = "invalid key")] fn invalid_get_mut_panics() { let mut slab = Slab::<usize>::new(); let _ = &mut slab[0]; } #[test] #[should_panic(expected = "invalid key")] fn double_remove_panics() { let mut slab = Slab::<usize>::with_capacity(1); let key = slab.insert(123); slab.remove(key); slab.remove(key); } #[test] #[should_panic(expected = "invalid key")] fn invalid_remove_panics() { let mut slab = Slab::<usize>::with_capacity(1); slab.remove(0); } #[test] fn slab_get_mut() { let mut slab = Slab::new(); let key = slab.insert(1); slab[key] = 2; assert_eq!(slab[key], 2); *slab.get_mut(key).unwrap() = 3; assert_eq!(slab[key], 3); } #[test] fn key_of_tagged() { let mut slab = Slab::new(); slab.insert(0); assert_eq!(slab.key_of(&slab[0]), 0); } #[test] fn key_of_layout_optimizable() { // Entry<&str> doesn't need a discriminant tag because it can use the // nonzero-ness of ptr and store Vacant's next at the same offset as len let mut slab = Slab::new(); slab.insert("foo"); slab.insert("bar"); let third = slab.insert("baz"); slab.insert("quux"); assert_eq!(slab.key_of(&slab[third]), third); } #[test] fn key_of_zst() { let mut slab = Slab::new(); slab.insert(()); let second = slab.insert(()); slab.insert(()); assert_eq!(slab.key_of(&slab[second]), second); } #[test] fn reserve_does_not_allocate_if_available() { let mut slab = Slab::with_capacity(10); let mut keys = vec![]; for i in 0..6 { keys.push(slab.insert(i)); } for key in 0..4 { slab.remove(key); } assert!(slab.capacity() - slab.len() == 8); slab.reserve(8); assert_eq!(10, slab.capacity()); } #[test] fn reserve_exact_does_not_allocate_if_available() { let mut slab = Slab::with_capacity(10); let mut keys = vec![]; for i in 0..6 { keys.push(slab.insert(i)); } for key in 0..4 { slab.remove(key); } assert!(slab.capacity() - slab.len() == 8); slab.reserve_exact(8); assert_eq!(10, slab.capacity()); } #[test] #[should_panic(expected = "capacity overflow")] fn reserve_does_panic_with_capacity_overflow() { let mut slab = Slab::with_capacity(10); slab.insert(true); slab.reserve(std::isize::MAX as usize); } #[test] #[should_panic(expected = "capacity overflow")] fn reserve_does_panic_with_capacity_overflow_bytes() { let mut slab = Slab::with_capacity(10); slab.insert(1u16); slab.reserve((std::isize::MAX as usize) / 2); } #[test] #[should_panic(expected = "capacity overflow")] fn reserve_exact_does_panic_with_capacity_overflow() { let mut slab = Slab::with_capacity(10); slab.insert(true); slab.reserve_exact(std::isize::MAX as usize); } #[test] fn retain() { let mut slab = Slab::with_capacity(2); let key1 = slab.insert(0); let key2 = slab.insert(1); slab.retain(|key, x| { assert_eq!(key, *x); *x % 2 == 0 }); assert_eq!(slab.len(), 1); assert_eq!(slab[key1], 0); assert!(!slab.contains(key2)); // Ensure consistency is retained let key = slab.insert(123); assert_eq!(key, key2); assert_eq!(2, slab.len()); assert_eq!(2, slab.capacity()); // Inserting another element grows let key = slab.insert(345); assert_eq!(key, 2); assert_eq!(4, slab.capacity()); } #[test] fn into_iter() { let mut slab = Slab::new(); for i in 0..8 { slab.insert(i); } slab.remove(0); slab.remove(4); slab.remove(5); slab.remove(7); let vals: Vec<_> = slab .into_iter() .inspect(|&(key, val)| assert_eq!(key, val)) .map(|(_, val)| val) .collect(); assert_eq!(vals, vec![1, 2, 3, 6]); } #[test] fn into_iter_rev() { let mut slab = Slab::new(); for i in 0..4 { slab.insert(i); } let mut iter = slab.into_iter(); assert_eq!(iter.next_back(), Some((3, 3))); assert_eq!(iter.next_back(), Some((2, 2))); assert_eq!(iter.next(), Some((0, 0))); assert_eq!(iter.next_back(), Some((1, 1))); assert_eq!(iter.next_back(), None); assert_eq!(iter.next(), None); } #[test] fn iter() { let mut slab = Slab::new(); for i in 0..4 { slab.insert(i); } let vals: Vec<_> = slab .iter() .enumerate() .map(|(i, (key, val))| { assert_eq!(i, key); *val }) .collect(); assert_eq!(vals, vec![0, 1, 2, 3]); slab.remove(1); let vals: Vec<_> = slab.iter().map(|(_, r)| *r).collect(); assert_eq!(vals, vec![0, 2, 3]); } #[test] fn iter_rev() { let mut slab = Slab::new(); for i in 0..4 { slab.insert(i); } slab.remove(0); let vals = slab.iter().rev().collect::<Vec<_>>(); assert_eq!(vals, vec![(3, &3), (2, &2), (1, &1)]); } #[test] fn iter_mut() { let mut slab = Slab::new(); for i in 0..4 { slab.insert(i); } for (i, (key, e)) in slab.iter_mut().enumerate() { assert_eq!(i, key); *e += 1; } let vals: Vec<_> = slab.iter().map(|(_, r)| *r).collect(); assert_eq!(vals, vec![1, 2, 3, 4]); slab.remove(2); for (_, e) in slab.iter_mut() { *e += 1; } let vals: Vec<_> = slab.iter().map(|(_, r)| *r).collect(); assert_eq!(vals, vec![2, 3, 5]); } #[test] fn iter_mut_rev() { let mut slab = Slab::new(); for i in 0..4 { slab.insert(i); } slab.remove(2); { let mut iter = slab.iter_mut(); assert_eq!(iter.next(), Some((0, &mut 0))); let mut prev_key = !0; for (key, e) in iter.rev() { *e += 10; assert!(prev_key > key); prev_key = key; } } assert_eq!(slab[0], 0); assert_eq!(slab[1], 11); assert_eq!(slab[3], 13); assert!(!slab.contains(2)); } #[test] fn from_iterator_sorted() { let mut slab = (0..5).map(|i| (i, i)).collect::<Slab<_>>(); assert_eq!(slab.len(), 5); assert_eq!(slab[0], 0); assert_eq!(slab[2], 2); assert_eq!(slab[4], 4); assert_eq!(slab.vacant_entry().key(), 5); } #[test] fn from_iterator_new_in_order() { // all new keys come in increasing order, but existing keys are overwritten let mut slab = [(0, 'a'), (1, 'a'), (1, 'b'), (0, 'b'), (9, 'a'), (0, 'c')] .iter() .cloned() .collect::<Slab<_>>(); assert_eq!(slab.len(), 3); assert_eq!(slab[0], 'c'); assert_eq!(slab[1], 'b'); assert_eq!(slab[9], 'a'); assert_eq!(slab.get(5), None); assert_eq!(slab.vacant_entry().key(), 8); } #[test] fn from_iterator_unordered() { let mut slab = vec![(1, "one"), (50, "fifty"), (3, "three"), (20, "twenty")] .into_iter() .collect::<Slab<_>>(); assert_eq!(slab.len(), 4); assert_eq!(slab.vacant_entry().key(), 0); let mut iter = slab.iter(); assert_eq!(iter.next(), Some((1, &"one"))); assert_eq!(iter.next(), Some((3, &"three"))); assert_eq!(iter.next(), Some((20, &"twenty"))); assert_eq!(iter.next(), Some((50, &"fifty"))); assert_eq!(iter.next(), None); } // https://github.com/tokio-rs/slab/issues/100 #[test] fn from_iterator_issue_100() { let mut slab: slab::Slab<()> = vec![(1, ())].into_iter().collect(); assert_eq!(slab.len(), 1); assert_eq!(slab.insert(()), 0); assert_eq!(slab.insert(()), 2); assert_eq!(slab.insert(()), 3); let mut slab: slab::Slab<()> = vec![(1, ()), (2, ())].into_iter().collect(); assert_eq!(slab.len(), 2); assert_eq!(slab.insert(()), 0); assert_eq!(slab.insert(()), 3); assert_eq!(slab.insert(()), 4); let mut slab: slab::Slab<()> = vec![(1, ()), (3, ())].into_iter().collect(); assert_eq!(slab.len(), 2); assert_eq!(slab.insert(()), 2); assert_eq!(slab.insert(()), 0); assert_eq!(slab.insert(()), 4); let mut slab: slab::Slab<()> = vec![(0, ()), (2, ()), (3, ()), (5, ())] .into_iter() .collect(); assert_eq!(slab.len(), 4); assert_eq!(slab.insert(()), 4); assert_eq!(slab.insert(()), 1); assert_eq!(slab.insert(()), 6); } #[test] fn clear() { let mut slab = Slab::new(); for i in 0..4 { slab.insert(i); } // clear full slab.clear(); assert!(slab.is_empty()); assert_eq!(0, slab.len()); assert_eq!(4, slab.capacity()); for i in 0..2 { slab.insert(i); } let vals: Vec<_> = slab.iter().map(|(_, r)| *r).collect(); assert_eq!(vals, vec![0, 1]); // clear half-filled slab.clear(); assert!(slab.is_empty()); } #[test] fn shrink_to_fit_empty() { let mut slab = Slab::<bool>::with_capacity(20); slab.shrink_to_fit(); assert_eq!(slab.capacity(), 0); } #[test] fn shrink_to_fit_no_vacant() { let mut slab = Slab::with_capacity(20); slab.insert(String::new()); slab.shrink_to_fit(); assert!(slab.capacity() < 10); } #[test] fn shrink_to_fit_doesnt_move() { let mut slab = Slab::with_capacity(8); slab.insert("foo"); let bar = slab.insert("bar"); slab.insert("baz"); let quux = slab.insert("quux"); slab.remove(quux); slab.remove(bar); slab.shrink_to_fit(); assert_eq!(slab.len(), 2); assert!(slab.capacity() >= 3); assert_eq!(slab.get(0), Some(&"foo")); assert_eq!(slab.get(2), Some(&"baz")); assert_eq!(slab.vacant_entry().key(), bar); } #[test] fn shrink_to_fit_doesnt_recreate_list_when_nothing_can_be_done() { let mut slab = Slab::with_capacity(16); for i in 0..4 { slab.insert(Box::new(i)); } slab.remove(0); slab.remove(2); slab.remove(1); assert_eq!(slab.vacant_entry().key(), 1); slab.shrink_to_fit(); assert_eq!(slab.len(), 1); assert!(slab.capacity() >= 4); assert_eq!(slab.vacant_entry().key(), 1); } #[test] fn compact_empty() { let mut slab = Slab::new(); slab.compact(|_, _, _| panic!()); assert_eq!(slab.len(), 0); assert_eq!(slab.capacity(), 0); slab.reserve(20); slab.compact(|_, _, _| panic!()); assert_eq!(slab.len(), 0); assert_eq!(slab.capacity(), 0); slab.insert(0); slab.insert(1); slab.insert(2); slab.remove(1); slab.remove(2); slab.remove(0); slab.compact(|_, _, _| panic!()); assert_eq!(slab.len(), 0); assert_eq!(slab.capacity(), 0); } #[test] fn compact_no_moves_needed() { let mut slab = Slab::new(); for i in 0..10 { slab.insert(i); } slab.remove(8); slab.remove(9); slab.remove(6); slab.remove(7); slab.compact(|_, _, _| panic!()); assert_eq!(slab.len(), 6); for ((index, &value), want) in slab.iter().zip(0..6) { assert!(index == value); assert_eq!(index, want); } assert!(slab.capacity() >= 6 && slab.capacity() < 10); } #[test] fn compact_moves_successfully() { let mut slab = Slab::with_capacity(20); for i in 0..10 { slab.insert(i); } for &i in &[0, 5, 9, 6, 3] { slab.remove(i); } let mut moved = 0; slab.compact(|&mut v, from, to| { assert!(from > to); assert!(from >= 5); assert!(to < 5); assert_eq!(from, v); moved += 1; true }); assert_eq!(slab.len(), 5); assert_eq!(moved, 2); assert_eq!(slab.vacant_entry().key(), 5); assert!(slab.capacity() >= 5 && slab.capacity() < 20); let mut iter = slab.iter(); assert_eq!(iter.next(), Some((0, &8))); assert_eq!(iter.next(), Some((1, &1))); assert_eq!(iter.next(), Some((2, &2))); assert_eq!(iter.next(), Some((3, &7))); assert_eq!(iter.next(), Some((4, &4))); assert_eq!(iter.next(), None); } #[test] fn compact_doesnt_move_if_closure_errors() { let mut slab = Slab::with_capacity(20); for i in 0..10 { slab.insert(i); } for &i in &[9, 3, 1, 4, 0] { slab.remove(i); } slab.compact(|&mut v, from, to| { assert!(from > to); assert_eq!(from, v); v != 6 }); assert_eq!(slab.len(), 5); assert!(slab.capacity() >= 7 && slab.capacity() < 20); assert_eq!(slab.vacant_entry().key(), 3); let mut iter = slab.iter(); assert_eq!(iter.next(), Some((0, &8))); assert_eq!(iter.next(), Some((1, &7))); assert_eq!(iter.next(), Some((2, &2))); assert_eq!(iter.next(), Some((5, &5))); assert_eq!(iter.next(), Some((6, &6))); assert_eq!(iter.next(), None); } #[test] fn compact_handles_closure_panic() { let mut slab = Slab::new(); for i in 0..10 { slab.insert(i); } for i in 1..6 { slab.remove(i); } let result = catch_unwind(AssertUnwindSafe(|| { slab.compact(|&mut v, from, to| { assert!(from > to); assert_eq!(from, v); if v == 7 { panic!("test"); } true }) })); match result { Err(ref payload) if payload.downcast_ref() == Some(&"test") => {} Err(bug) => resume_unwind(bug), Ok(()) => unreachable!(), } assert_eq!(slab.len(), 5 - 1); assert_eq!(slab.vacant_entry().key(), 3); let mut iter = slab.iter(); assert_eq!(iter.next(), Some((0, &0))); assert_eq!(iter.next(), Some((1, &9))); assert_eq!(iter.next(), Some((2, &8))); assert_eq!(iter.next(), Some((6, &6))); assert_eq!(iter.next(), None); } #[test] fn fully_consumed_drain() { let mut slab = Slab::new(); for i in 0..3 { slab.insert(i); } { let mut drain = slab.drain(); assert_eq!(Some(0), drain.next()); assert_eq!(Some(1), drain.next()); assert_eq!(Some(2), drain.next()); assert_eq!(None, drain.next()); } assert!(slab.is_empty()); } #[test] fn partially_consumed_drain() { let mut slab = Slab::new(); for i in 0..3 { slab.insert(i); } { let mut drain = slab.drain(); assert_eq!(Some(0), drain.next()); } assert!(slab.is_empty()) } #[test] fn drain_rev() { let mut slab = Slab::new(); for i in 0..10 { slab.insert(i); } slab.remove(9); let vals: Vec<u64> = slab.drain().rev().collect(); assert_eq!(vals, (0..9).rev().collect::<Vec<u64>>()); } #[test] fn try_remove() { let mut slab = Slab::new(); let key = slab.insert(1); assert_eq!(slab.try_remove(key), Some(1)); assert_eq!(slab.try_remove(key), None); assert_eq!(slab.get(key), None); } #[rustversion::since(1.39)] #[test] fn const_new() { static _SLAB: Slab<()> = Slab::new(); } #[test] fn clone_from() { let mut slab1 = Slab::new(); let mut slab2 = Slab::new(); for i in 0..5 { slab1.insert(i); slab2.insert(2 * i); slab2.insert(2 * i + 1); } slab1.remove(1); slab1.remove(3); slab2.clone_from(&slab1); let mut iter2 = slab2.iter(); assert_eq!(iter2.next(), Some((0, &0))); assert_eq!(iter2.next(), Some((2, &2))); assert_eq!(iter2.next(), Some((4, &4))); assert_eq!(iter2.next(), None); assert!(slab2.capacity() >= 10); }
#![allow(dead_code, non_camel_case_types, non_upper_case_globals, non_snake_case)] //! Little Color Management System //! Copyright (c) 1998-2014 Marti Maria Saguer //! //! 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. //! //!--------------------------------------------------------------------------------- //! //! Version 2.8 use std::os::raw::{c_char, c_int, c_long, c_void}; #[doc(hidden)] use libc; use std::mem; use libc::FILE; use std::default::Default; // That one is missing in Rust's libc #[cfg(not(windows))] #[doc(hidden)] pub type tm = libc::tm; #[cfg(windows)] #[doc(hidden)] #[repr(C)] #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct tm { tm_sec: c_int, tm_min: c_int, tm_hour: c_int, tm_mday: c_int, tm_mon: c_int, tm_year: c_int, tm_wday: c_int, tm_yday: c_int, tm_isdst: c_int, } #[doc(hidden)] pub type wchar_t = libc::wchar_t; pub type Signature = u32; pub type S15Fixed16Number = i32; pub type Bool = c_int; /// D50 XYZ normalized to Y=1.0 pub const D50X: f64 = 0.9642; pub const D50Y: f64 = 1.0; pub const D50Z: f64 = 0.8249; /// V4 perceptual black pub const PERCEPTUAL_BLACK_X: f64 = 0.00336; pub const PERCEPTUAL_BLACK_Y: f64 = 0.0034731; pub const PERCEPTUAL_BLACK_Z: f64 = 0.00287; /// Definitions in ICC spec /// 'acsp' pub const MagicNumber: Signature = 0x61637370; /// 'lcms' pub const lcmsSignature: Signature = 0x6c636d73; #[derive(Copy, Clone, PartialEq, Eq, Hash)] #[repr(u32)] #[derive(Debug)] pub enum TagTypeSignature { /// 'chrm' ChromaticityType = 0x6368726D, /// 'clro' ColorantOrderType = 0x636C726F, /// 'clrt' ColorantTableType = 0x636C7274, /// 'crdi' CrdInfoType = 0x63726469, /// 'curv' CurveType = 0x63757276, /// 'data' DataType = 0x64617461, /// 'dict' DictType = 0x64696374, /// 'dtim' DateTimeType = 0x6474696D, /// 'devs' DeviceSettingsType = 0x64657673, /// 'mft2' Lut16Type = 0x6d667432, /// 'mft1' Lut8Type = 0x6d667431, /// 'mAB ' LutAtoBType = 0x6d414220, /// 'mBA ' LutBtoAType = 0x6d424120, /// 'meas' MeasurementType = 0x6D656173, /// 'mluc' MultiLocalizedUnicodeType = 0x6D6C7563, /// 'mpet' MultiProcessElementType = 0x6D706574, /// 'ncol' -- DEPRECATED! NamedColorType = 0x6E636F6C, /// 'ncl2' NamedColor2Type = 0x6E636C32, /// 'para' ParametricCurveType = 0x70617261, /// 'pseq' ProfileSequenceDescType = 0x70736571, /// 'psid' ProfileSequenceIdType = 0x70736964, /// 'rcs2' ResponseCurveSet16Type = 0x72637332, /// 'sf32' S15Fixed16ArrayType = 0x73663332, /// 'scrn' ScreeningType = 0x7363726E, /// 'sig ' SignatureType = 0x73696720, /// 'text' TextType = 0x74657874, /// 'desc' TextDescriptionType = 0x64657363, /// 'uf32' U16Fixed16ArrayType = 0x75663332, /// 'bfd ' UcrBgType = 0x62666420, /// 'ui16' UInt16ArrayType = 0x75693136, /// 'ui32' UInt32ArrayType = 0x75693332, /// 'ui64' UInt64ArrayType = 0x75693634, /// 'ui08' UInt8ArrayType = 0x75693038, /// 'vcgt' VcgtType = 0x76636774, /// 'view' ViewingConditionsType = 0x76696577, /// 'XYZ ' XYZType = 0x58595A20 } pub const BlueMatrixColumnTag: TagSignature = TagSignature::BlueColorantTag; pub const GreenMatrixColumnTag: TagSignature = TagSignature::GreenColorantTag; pub const RedMatrixColumnTag: TagSignature = TagSignature::RedColorantTag; #[derive(Copy, Clone, PartialEq, Eq, Hash)] #[repr(u32)] #[derive(Debug)] pub enum TagSignature { /// 'A2B0' AToB0Tag = 0x41324230, /// 'A2B1' AToB1Tag = 0x41324231, /// 'A2B2' AToB2Tag = 0x41324232, /// 'bXYZ' BlueColorantTag = 0x6258595A, /// 'bTRC' BlueTRCTag = 0x62545243, /// 'B2A0' BToA0Tag = 0x42324130, /// 'B2A1' BToA1Tag = 0x42324131, /// 'B2A2' BToA2Tag = 0x42324132, /// 'calt' CalibrationDateTimeTag = 0x63616C74, /// 'targ' CharTargetTag = 0x74617267, /// 'chad' ChromaticAdaptationTag = 0x63686164, /// 'chrm' ChromaticityTag = 0x6368726D, /// 'clro' ColorantOrderTag = 0x636C726F, /// 'clrt' ColorantTableTag = 0x636C7274, /// 'clot' ColorantTableOutTag = 0x636C6F74, /// 'ciis' ColorimetricIntentImageStateTag = 0x63696973, /// 'cprt' CopyrightTag = 0x63707274, /// 'crdi' CrdInfoTag = 0x63726469, /// 'data' DataTag = 0x64617461, /// 'dtim' DateTimeTag = 0x6474696D, /// 'dmnd' DeviceMfgDescTag = 0x646D6E64, /// 'dmdd' DeviceModelDescTag = 0x646D6464, /// 'devs' DeviceSettingsTag = 0x64657673, /// 'D2B0' DToB0Tag = 0x44324230, /// 'D2B1' DToB1Tag = 0x44324231, /// 'D2B2' DToB2Tag = 0x44324232, /// 'D2B3' DToB3Tag = 0x44324233, /// 'B2D0' BToD0Tag = 0x42324430, /// 'B2D1' BToD1Tag = 0x42324431, /// 'B2D2' BToD2Tag = 0x42324432, /// 'B2D3' BToD3Tag = 0x42324433, /// 'gamt' GamutTag = 0x67616D74, /// 'kTRC' GrayTRCTag = 0x6b545243, /// 'gXYZ' GreenColorantTag = 0x6758595A, /// 'gTRC' GreenTRCTag = 0x67545243, /// 'lumi' LuminanceTag = 0x6C756D69, /// 'meas' MeasurementTag = 0x6D656173, /// 'bkpt' MediaBlackPointTag = 0x626B7074, /// 'wtpt' MediaWhitePointTag = 0x77747074, /// 'ncol' // Deprecated by the ICC NamedColorTag = 0x6E636F6C, /// 'ncl2' NamedColor2Tag = 0x6E636C32, /// 'resp' OutputResponseTag = 0x72657370, /// 'rig0' PerceptualRenderingIntentGamutTag = 0x72696730, /// 'pre0' Preview0Tag = 0x70726530, /// 'pre1' Preview1Tag = 0x70726531, /// 'pre2' Preview2Tag = 0x70726532, /// 'desc' ProfileDescriptionTag = 0x64657363, /// 'dscm' ProfileDescriptionMLTag = 0x6473636D, /// 'pseq' ProfileSequenceDescTag = 0x70736571, /// 'psid' ProfileSequenceIdTag = 0x70736964, /// 'psd0' Ps2CRD0Tag = 0x70736430, /// 'psd1' Ps2CRD1Tag = 0x70736431, /// 'psd2' Ps2CRD2Tag = 0x70736432, /// 'psd3' Ps2CRD3Tag = 0x70736433, /// 'ps2s' Ps2CSATag = 0x70733273, /// 'ps2i' Ps2RenderingIntentTag = 0x70733269, /// 'rXYZ' RedColorantTag = 0x7258595A, /// 'rTRC' RedTRCTag = 0x72545243, /// 'rig2' SaturationRenderingIntentGamutTag = 0x72696732, /// 'scrd' ScreeningDescTag = 0x73637264, /// 'scrn' ScreeningTag = 0x7363726E, /// 'tech' TechnologyTag = 0x74656368, /// 'bfd ' UcrBgTag = 0x62666420, /// 'vued' ViewingCondDescTag = 0x76756564, /// 'view' ViewingConditionsTag = 0x76696577, /// 'vcgt' VcgtTag = 0x76636774, /// 'meta' MetaTag = 0x6D657461, /// 'arts' ArgyllArtsTag = 0x61727473, } pub use self::TagSignature::*; #[derive(Copy, Clone, PartialEq, Eq, Hash)] #[repr(u32)] #[derive(Debug)] pub enum TechnologySignature { /// 'dcam' DigitalCamera = 0x6463616D, /// 'fscn' FilmScanner = 0x6673636E, /// 'rscn' ReflectiveScanner = 0x7273636E, /// 'ijet' InkJetPrinter = 0x696A6574, /// 'twax' ThermalWaxPrinter = 0x74776178, /// 'epho' ElectrophotographicPrinter = 0x6570686F, /// 'esta' ElectrostaticPrinter = 0x65737461, /// 'dsub' DyeSublimationPrinter = 0x64737562, /// 'rpho' PhotographicPaperPrinter = 0x7270686F, /// 'fprn' FilmWriter = 0x6670726E, /// 'vidm' VideoMonitor = 0x7669646D, /// 'vidc' VideoCamera = 0x76696463, /// 'pjtv' ProjectionTelevision = 0x706A7476, /// 'CRT ' CRTDisplay = 0x43525420, /// 'PMD ' PMDisplay = 0x504D4420, /// 'AMD ' AMDisplay = 0x414D4420, /// 'KPCD' PhotoCD = 0x4B504344, /// 'imgs' PhotoImageSetter = 0x696D6773, /// 'grav' Gravure = 0x67726176, /// 'offs' OffsetLithography = 0x6F666673, /// 'silk' Silkscreen = 0x73696C6B, /// 'flex' Flexography = 0x666C6578, /// 'mpfs' MotionPictureFilmScanner = 0x6D706673, /// 'mpfr' MotionPictureFilmRecorder = 0x6D706672, /// 'dmpc' DigitalMotionPictureCamera = 0x646D7063, /// 'dcpj' DigitalCinemaProjector = 0x64636A70 } #[derive(Copy, Clone, PartialEq, Eq, Hash)] #[repr(u32)] #[derive(Debug)] pub enum ColorSpaceSignature { /// 'XYZ ' XYZData = 0x58595A20, /// 'Lab ' LabData = 0x4C616220, /// 'Luv ' LuvData = 0x4C757620, /// 'YCbr' YCbCrData = 0x59436272, /// 'Yxy ' YxyData = 0x59787920, /// 'RGB ' RgbData = 0x52474220, /// 'GRAY' GrayData = 0x47524159, /// 'HSV ' HsvData = 0x48535620, /// 'HLS ' HlsData = 0x484C5320, /// 'CMYK' CmykData = 0x434D594B, /// 'CMY ' CmyData = 0x434D5920, /// 'MCH1' MCH1Data = 0x4D434831, /// 'MCH2' MCH2Data = 0x4D434832, /// 'MCH3' MCH3Data = 0x4D434833, /// 'MCH4' MCH4Data = 0x4D434834, /// 'MCH5' MCH5Data = 0x4D434835, /// 'MCH6' MCH6Data = 0x4D434836, /// 'MCH7' MCH7Data = 0x4D434837, /// 'MCH8' MCH8Data = 0x4D434838, /// 'MCH9' MCH9Data = 0x4D434839, /// 'MCHA' MCHAData = 0x4D434841, /// 'MCHB' MCHBData = 0x4D434842, /// 'MCHC' MCHCData = 0x4D434843, /// 'MCHD' MCHDData = 0x4D434844, /// 'MCHE' MCHEData = 0x4D434845, /// 'MCHF' MCHFData = 0x4D434846, /// 'nmcl' NamedData = 0x6e6d636c, /// '1CLR' Sig1colorData = 0x31434C52, /// '2CLR' Sig2colorData = 0x32434C52, /// '3CLR' Sig3colorData = 0x33434C52, /// '4CLR' Sig4colorData = 0x34434C52, /// '5CLR' Sig5colorData = 0x35434C52, /// '6CLR' Sig6colorData = 0x36434C52, /// '7CLR' Sig7colorData = 0x37434C52, /// '8CLR' Sig8colorData = 0x38434C52, /// '9CLR' Sig9colorData = 0x39434C52, /// 'ACLR' Sig10colorData = 0x41434C52, /// 'BCLR' Sig11colorData = 0x42434C52, /// 'CCLR' Sig12colorData = 0x43434C52, /// 'DCLR' Sig13colorData = 0x44434C52, /// 'ECLR' Sig14colorData = 0x45434C52, /// 'FCLR' Sig15colorData = 0x46434C52, /// 'LuvK' LuvKData = 0x4C75764B } #[derive(Copy, Clone, PartialEq, Eq, Hash)] #[repr(u32)] #[derive(Debug)] pub enum ProfileClassSignature { /// 'scnr' InputClass = 0x73636E72, /// 'mntr' DisplayClass = 0x6D6E7472, /// 'prtr' OutputClass = 0x70727472, /// 'link' LinkClass = 0x6C696E6B, /// 'abst' AbstractClass = 0x61627374, /// 'spac' ColorSpaceClass = 0x73706163, /// 'nmcl' NamedColorClass = 0x6e6d636c } #[derive(Copy, Clone, PartialEq, Eq, Hash)] #[repr(u32)] #[derive(Debug)] pub enum PlatformSignature { /// 'APPL' Macintosh = 0x4150504C, /// 'MSFT' Microsoft = 0x4D534654, /// 'SUNW' Solaris = 0x53554E57, /// 'SGI ' SGI = 0x53474920, /// 'TGNT' Taligent = 0x54474E54, /// '*nix' // From argyll -- Not official Unices = 0x2A6E6978 } ///'prmg' pub const PerceptualReferenceMediumGamut:u32 = 0x70726d67; #[derive(Copy, Clone, PartialEq, Eq, Hash)] #[repr(u32)] #[derive(Debug)] pub enum ColorimetricIntentImageState { ///'scoe' SceneColorimetryEstimates = 0x73636F65, ///'sape' SceneAppearanceEstimates = 0x73617065, ///'fpce' FocalPlaneColorimetryEstimates = 0x66706365, ///'rhoc' ReflectionHardcopyOriginalColorimetry = 0x72686F63, ///'rpoc' ReflectionPrintOutputColorimetry = 0x72706F63, } pub use crate::ColorimetricIntentImageState::*; #[derive(Copy, Clone, PartialEq, Eq, Hash)] #[repr(u32)] #[derive(Debug)] pub enum StageSignature { ///'cvst' CurveSetElemType = 0x63767374, ///'matf' MatrixElemType = 0x6D617466, ///'clut' CLutElemType = 0x636C7574, /// 'bACS' BAcsElemType = 0x62414353, /// 'eACS' EAcsElemType = 0x65414353, /// Custom from here, not in the ICC Spec /// 'l2x ' XYZ2LabElemType = 0x6C327820, /// 'x2l ' Lab2XYZElemType = 0x78326C20, /// 'ncl ' NamedColorElemType = 0x6E636C20, /// '2 4 ' LabV2toV4 = 0x32203420, /// '4 2 ' LabV4toV2 = 0x34203220, /// Identities /// 'idn ' IdentityElemType = 0x69646E20, /// Float to floatPCS /// 'd2l ' Lab2FloatPCS = 0x64326C20, /// 'l2d ' FloatPCS2Lab = 0x6C326420, /// 'd2x ' XYZ2FloatPCS = 0x64327820, /// 'x2d ' FloatPCS2XYZ = 0x78326420, /// 'clp ' ClipNegativesElemType = 0x636c7020 } #[derive(Copy, Clone, PartialEq, Eq, Hash)] #[repr(u32)] #[derive(Debug)] pub enum CurveSegSignature { /// 'parf' FormulaCurveSeg = 0x70617266, /// 'samf' SampledCurveSeg = 0x73616D66, /// 'curf' SegmentedCurve = 0x63757266 } ///'StaA' pub const StatusA:u32 = 0x53746141; ///'StaE' pub const StatusE:u32 = 0x53746145; ///'StaI' pub const StatusI:u32 = 0x53746149; ///'StaT' pub const StatusT:u32 = 0x53746154; ///'StaM' pub const StatusM:u32 = 0x5374614D; ///'DN ' pub const DN:u32 = 0x444E2020; ///'DN P' pub const DNP:u32 = 0x444E2050; ///'DNN ' pub const DNN:u32 = 0x444E4E20; ///'DNNP' pub const DNNP:u32 = 0x444E4E50; /// Device attributes, currently defined values correspond to the low 4 bytes /// of the 8 byte attribute quantity pub const Reflective:u32 = 0; pub const Transparency:u32 = 1; pub const Glossy:u32 = 0; pub const Matte:u32 = 2; #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] pub struct ICCData { pub len: u32, pub flag: u32, pub data: [u8; 1], } impl Default for ICCData { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy, Clone, PartialEq, Eq)] #[derive(Debug)] pub struct DateTimeNumber { pub year: u16, pub month: u16, pub day: u16, pub hours: u16, pub minutes: u16, pub seconds: u16, } impl Default for DateTimeNumber { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy, Clone, PartialEq, Eq)] #[derive(Debug)] pub struct EncodedXYZNumber { pub X: S15Fixed16Number, pub Y: S15Fixed16Number, pub Z: S15Fixed16Number, } impl Default for EncodedXYZNumber { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy, Clone, PartialEq, Eq, Hash)] #[derive(Debug)] /// Profile ID as computed by MD5 algorithm pub struct ProfileID { pub ID32: [u32; 4], } impl Default for ProfileID { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] pub struct ICCHeader { /// Profile size in bytes pub size: u32, /// CMM for this profile pub cmmId: Signature, /// Format version number pub version: u32, /// Type of profile pub deviceClass: ProfileClassSignature, /// Color space of data pub colorSpace: ColorSpaceSignature, /// PCS, XYZ or Lab only pub pcs: ColorSpaceSignature, /// Date profile was created pub date: DateTimeNumber, /// Magic Number to identify an ICC profile pub magic: Signature, /// Primary Platform pub platform: PlatformSignature, /// Various bit settings pub flags: u32, /// Device manufacturer pub manufacturer: Signature, /// Device model number pub model: u32, /// Device attributes pub attributes: u64, /// Rendering intent pub renderingIntent: Intent, /// Profile illuminant pub illuminant: EncodedXYZNumber, /// Profile creator pub creator: Signature, /// Profile ID using MD5 pub profileID: ProfileID, /// Reserved for future use pub reserved: [i8; 28], } impl Default for ICCHeader { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] pub struct TagBase { pub sig: TagTypeSignature, pub reserved: [i8; 4], } impl Default for TagBase { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy, Clone, PartialEq)] #[derive(Debug)] pub struct TagEntry { pub sig: TagSignature, pub offset: u32, pub size: u32, } impl Default for TagEntry { fn default() -> Self { unsafe { mem::zeroed() } } } pub type HANDLE = *mut c_void; #[repr(C)] pub struct _HPROFILE { _opaque_type: [u8; 0] } pub type HPROFILE = *mut _HPROFILE; #[repr(C)] pub struct _HTRANSFORM { _opaque_type: [u8; 0] } pub type HTRANSFORM = *mut _HTRANSFORM; /// Maximum number of channels in ICC profiles pub const MAXCHANNELS: usize = 16; #[repr(C)] #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct PixelType(pub u32); // Pixel types /// Don't check colorspace pub const PT_ANY: PixelType = PixelType(0); /// 1 & 2 are reserved pub const PT_GRAY: PixelType = PixelType(3); pub const PT_RGB: PixelType = PixelType(4); pub const PT_CMY: PixelType = PixelType(5); pub const PT_CMYK: PixelType = PixelType(6); pub const PT_YCbCr: PixelType = PixelType(7); /// Lu'v' pub const PT_YUV: PixelType = PixelType(8); pub const PT_XYZ: PixelType = PixelType(9); pub const PT_Lab: PixelType = PixelType(10); /// Lu'v'K pub const PT_YUVK: PixelType = PixelType(11); pub const PT_HSV: PixelType = PixelType(12); pub const PT_HLS: PixelType = PixelType(13); pub const PT_Yxy: PixelType = PixelType(14); pub const PT_MCH1: PixelType = PixelType(15); pub const PT_MCH2: PixelType = PixelType(16); pub const PT_MCH3: PixelType = PixelType(17); pub const PT_MCH4: PixelType = PixelType(18); pub const PT_MCH5: PixelType = PixelType(19); pub const PT_MCH6: PixelType = PixelType(20); pub const PT_MCH7: PixelType = PixelType(21); pub const PT_MCH8: PixelType = PixelType(22); pub const PT_MCH9: PixelType = PixelType(23); pub const PT_MCH10: PixelType = PixelType(24); pub const PT_MCH11: PixelType = PixelType(25); pub const PT_MCH12: PixelType = PixelType(26); pub const PT_MCH13: PixelType = PixelType(27); pub const PT_MCH14: PixelType = PixelType(28); pub const PT_MCH15: PixelType = PixelType(29); /// Identical to PT_Lab, but using the V2 old encoding pub const PT_LabV2: PixelType = PixelType(30); /// Format of pixel is defined by one cmsUInt32Number, using bit fields as follows /// /// 2 1 0 /// 3 2 10987 6 5 4 3 2 1 098 7654 321 /// A O TTTTT U Y F P X S EEE CCCC BBB /// /// A: Floating point -- With this flag we can differentiate 16 bits as float and as int /// O: Optimized -- previous optimization already returns the final 8-bit value /// T: Pixeltype /// F: Flavor 0=MinIsBlack(Chocolate) 1=MinIsWhite(Vanilla) /// P: Planar? 0=Chunky, 1=Planar /// X: swap 16 bps endianness? /// S: Do swap? ie, BGR, KYMC /// E: Extra samples /// C: Channels (Samples per pixel) /// B: bytes per sample /// Y: Swap first - changes ABGR to BGRA and KCMY to CMYK #[repr(C)] #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct PixelFormat(pub u32); impl PixelFormat { pub const GRAY_8: PixelFormat = PixelFormat(196617); pub const GRAY_8_REV: PixelFormat = PixelFormat(204809); pub const GRAY_16: PixelFormat = PixelFormat(196618); pub const GRAY_16_REV: PixelFormat = PixelFormat(204810); pub const GRAY_16_SE: PixelFormat = PixelFormat(198666); pub const GRAYA_8: PixelFormat = PixelFormat(196745); pub const GRAYA_16: PixelFormat = PixelFormat(196746); pub const GRAYA_16_SE: PixelFormat = PixelFormat(198794); pub const GRAYA_8_PLANAR: PixelFormat = PixelFormat(200841); pub const GRAYA_16_PLANAR: PixelFormat = PixelFormat(200842); pub const RGB_8: PixelFormat = PixelFormat(262169); pub const RGB_8_PLANAR: PixelFormat = PixelFormat(266265); pub const BGR_8: PixelFormat = PixelFormat(263193); pub const BGR_8_PLANAR: PixelFormat = PixelFormat(267289); pub const RGB_16: PixelFormat = PixelFormat(262170); pub const RGB_16_PLANAR: PixelFormat = PixelFormat(266266); pub const RGB_16_SE: PixelFormat = PixelFormat(264218); pub const BGR_16: PixelFormat = PixelFormat(263194); pub const BGR_16_PLANAR: PixelFormat = PixelFormat(267290); pub const BGR_16_SE: PixelFormat = PixelFormat(265242); pub const RGBA_8: PixelFormat = PixelFormat(262297); pub const RGBA_8_PLANAR: PixelFormat = PixelFormat(266393); pub const RGBA_16: PixelFormat = PixelFormat(262298); pub const RGBA_16_PLANAR: PixelFormat = PixelFormat(266394); pub const RGBA_16_SE: PixelFormat = PixelFormat(264346); pub const ARGB_8: PixelFormat = PixelFormat(278681); pub const ARGB_8_PLANAR: PixelFormat = PixelFormat(282777); pub const ARGB_16: PixelFormat = PixelFormat(278682); pub const ABGR_8: PixelFormat = PixelFormat(263321); pub const ABGR_8_PLANAR: PixelFormat = PixelFormat(267417); pub const ABGR_16: PixelFormat = PixelFormat(263322); pub const ABGR_16_PLANAR: PixelFormat = PixelFormat(267418); pub const ABGR_16_SE: PixelFormat = PixelFormat(265370); pub const BGRA_8: PixelFormat = PixelFormat(279705); pub const BGRA_8_PLANAR: PixelFormat = PixelFormat(283801); pub const BGRA_16: PixelFormat = PixelFormat(279706); pub const BGRA_16_SE: PixelFormat = PixelFormat(281754); pub const CMY_8: PixelFormat = PixelFormat(327705); pub const CMY_8_PLANAR: PixelFormat = PixelFormat(331801); pub const CMY_16: PixelFormat = PixelFormat(327706); pub const CMY_16_PLANAR: PixelFormat = PixelFormat(331802); pub const CMY_16_SE: PixelFormat = PixelFormat(329754); pub const CMYK_8: PixelFormat = PixelFormat(393249); pub const CMYKA_8: PixelFormat = PixelFormat(393377); pub const CMYK_8_REV: PixelFormat = PixelFormat(401441); pub const CMYK_8_PLANAR: PixelFormat = PixelFormat(397345); pub const CMYK_16: PixelFormat = PixelFormat(393250); pub const CMYK_16_REV: PixelFormat = PixelFormat(401442); pub const CMYK_16_PLANAR: PixelFormat = PixelFormat(397346); pub const CMYK_16_SE: PixelFormat = PixelFormat(395298); pub const KYMC_8: PixelFormat = PixelFormat(394273); pub const KYMC_16: PixelFormat = PixelFormat(394274); pub const KYMC_16_SE: PixelFormat = PixelFormat(396322); pub const KCMY_8: PixelFormat = PixelFormat(409633); pub const KCMY_8_REV: PixelFormat = PixelFormat(417825); pub const KCMY_16: PixelFormat = PixelFormat(409634); pub const KCMY_16_REV: PixelFormat = PixelFormat(417826); pub const KCMY_16_SE: PixelFormat = PixelFormat(411682); pub const CMYK5_8: PixelFormat = PixelFormat(1245225); pub const CMYK5_16: PixelFormat = PixelFormat(1245226); pub const CMYK5_16_SE: PixelFormat = PixelFormat(1247274); pub const KYMC5_8: PixelFormat = PixelFormat(1246249); pub const KYMC5_16: PixelFormat = PixelFormat(1246250); pub const KYMC5_16_SE: PixelFormat = PixelFormat(1248298); pub const CMYK6_8: PixelFormat = PixelFormat(1310769); pub const CMYK6_8_PLANAR: PixelFormat = PixelFormat(1314865); pub const CMYK6_16: PixelFormat = PixelFormat(1310770); pub const CMYK6_16_PLANAR: PixelFormat = PixelFormat(1314866); pub const CMYK6_16_SE: PixelFormat = PixelFormat(1312818); pub const CMYK7_8: PixelFormat = PixelFormat(1376313); pub const CMYK7_16: PixelFormat = PixelFormat(1376314); pub const CMYK7_16_SE: PixelFormat = PixelFormat(1378362); pub const KYMC7_8: PixelFormat = PixelFormat(1377337); pub const KYMC7_16: PixelFormat = PixelFormat(1377338); pub const KYMC7_16_SE: PixelFormat = PixelFormat(1379386); pub const CMYK8_8: PixelFormat = PixelFormat(1441857); pub const CMYK8_16: PixelFormat = PixelFormat(1441858); pub const CMYK8_16_SE: PixelFormat = PixelFormat(1443906); pub const KYMC8_8: PixelFormat = PixelFormat(1442881); pub const KYMC8_16: PixelFormat = PixelFormat(1442882); pub const KYMC8_16_SE: PixelFormat = PixelFormat(1444930); pub const CMYK9_8: PixelFormat = PixelFormat(1507401); pub const CMYK9_16: PixelFormat = PixelFormat(1507402); pub const CMYK9_16_SE: PixelFormat = PixelFormat(1509450); pub const KYMC9_8: PixelFormat = PixelFormat(1508425); pub const KYMC9_16: PixelFormat = PixelFormat(1508426); pub const KYMC9_16_SE: PixelFormat = PixelFormat(1510474); pub const CMYK10_8: PixelFormat = PixelFormat(1572945); pub const CMYK10_16: PixelFormat = PixelFormat(1572946); pub const CMYK10_16_SE: PixelFormat = PixelFormat(1574994); pub const KYMC10_8: PixelFormat = PixelFormat(1573969); pub const KYMC10_16: PixelFormat = PixelFormat(1573970); pub const KYMC10_16_SE: PixelFormat = PixelFormat(1576018); pub const CMYK11_8: PixelFormat = PixelFormat(1638489); pub const CMYK11_16: PixelFormat = PixelFormat(1638490); pub const CMYK11_16_SE: PixelFormat = PixelFormat(1640538); pub const KYMC11_8: PixelFormat = PixelFormat(1639513); pub const KYMC11_16: PixelFormat = PixelFormat(1639514); pub const KYMC11_16_SE: PixelFormat = PixelFormat(1641562); pub const CMYK12_8: PixelFormat = PixelFormat(1704033); pub const CMYK12_16: PixelFormat = PixelFormat(1704034); pub const CMYK12_16_SE: PixelFormat = PixelFormat(1706082); pub const KYMC12_8: PixelFormat = PixelFormat(1705057); pub const KYMC12_16: PixelFormat = PixelFormat(1705058); pub const KYMC12_16_SE: PixelFormat = PixelFormat(1707106); pub const XYZ_16: PixelFormat = PixelFormat(589850); pub const Lab_8: PixelFormat = PixelFormat(655385); pub const LabV2_8: PixelFormat = PixelFormat(1966105); pub const ALab_8: PixelFormat = PixelFormat(671897); pub const ALabV2_8: PixelFormat = PixelFormat(1982617); pub const Lab_16: PixelFormat = PixelFormat(655386); pub const LabV2_16: PixelFormat = PixelFormat(1966106); pub const Yxy_16: PixelFormat = PixelFormat(917530); pub const YCbCr_8: PixelFormat = PixelFormat(458777); pub const YCbCr_8_PLANAR: PixelFormat = PixelFormat(462873); pub const YCbCr_16: PixelFormat = PixelFormat(458778); pub const YCbCr_16_PLANAR: PixelFormat = PixelFormat(462874); pub const YCbCr_16_SE: PixelFormat = PixelFormat(460826); pub const YUV_8: PixelFormat = PixelFormat(524313); pub const YUV_8_PLANAR: PixelFormat = PixelFormat(528409); pub const YUV_16: PixelFormat = PixelFormat(524314); pub const YUV_16_PLANAR: PixelFormat = PixelFormat(528410); pub const YUV_16_SE: PixelFormat = PixelFormat(526362); pub const HLS_8: PixelFormat = PixelFormat(851993); pub const HLS_8_PLANAR: PixelFormat = PixelFormat(856089); pub const HLS_16: PixelFormat = PixelFormat(851994); pub const HLS_16_PLANAR: PixelFormat = PixelFormat(856090); pub const HLS_16_SE: PixelFormat = PixelFormat(854042); pub const HSV_8: PixelFormat = PixelFormat(786457); pub const HSV_8_PLANAR: PixelFormat = PixelFormat(790553); pub const HSV_16: PixelFormat = PixelFormat(786458); pub const HSV_16_PLANAR: PixelFormat = PixelFormat(790554); pub const HSV_16_SE: PixelFormat = PixelFormat(788506); // Named color index. Only 16 bits allowed (don't check colorspace) pub const NAMED_COLOR_INDEX: PixelFormat = PixelFormat(10); pub const XYZ_FLT: PixelFormat = PixelFormat(4784156); pub const Lab_FLT: PixelFormat = PixelFormat(4849692); pub const LabA_FLT: PixelFormat = PixelFormat(4849820); pub const GRAY_FLT: PixelFormat = PixelFormat(4390924); pub const RGB_FLT: PixelFormat = PixelFormat(4456476); pub const RGBA_FLT: PixelFormat = PixelFormat(4456604); pub const ARGB_FLT: PixelFormat = PixelFormat(4472988); pub const BGR_FLT: PixelFormat = PixelFormat(4457500); pub const BGRA_FLT: PixelFormat = PixelFormat(4474012); pub const CMYK_FLT: PixelFormat = PixelFormat(4587556); pub const XYZ_DBL: PixelFormat = PixelFormat(4784152); pub const Lab_DBL: PixelFormat = PixelFormat(4849688); pub const GRAY_DBL: PixelFormat = PixelFormat(4390920); pub const RGB_DBL: PixelFormat = PixelFormat(4456472); pub const BGR_DBL: PixelFormat = PixelFormat(4457496); pub const CMYK_DBL: PixelFormat = PixelFormat(4587552); pub const GRAY_HALF_FLT: PixelFormat = PixelFormat(4390922); pub const RGB_HALF_FLT: PixelFormat = PixelFormat(4456474); pub const RGBA_HALF_FLT: PixelFormat = PixelFormat(4456602); pub const CMYK_HALF_FLT: PixelFormat = PixelFormat(4587554); pub const ARGB_HALF_FLT: PixelFormat = PixelFormat(4472986); pub const BGR_HALF_FLT: PixelFormat = PixelFormat(4457498); pub const BGRA_HALF_FLT: PixelFormat = PixelFormat(4474010); /// A: Floating point -- With this flag we can differentiate 16 bits as float and as int pub fn float(&self) -> bool { ((self.0 >> 22) & 1) != 0 } /// O: Optimized -- previous optimization already returns the final 8-bit value pub fn optimized(&self) -> bool { ((self.0 >> 21) & 1) != 0 } /// T: Color space (`PT_*`) pub fn pixel_type(&self) -> PixelType { PixelType((self.0 >> 16) & 31) } /// Y: Swap first - changes ABGR to BGRA and KCMY to CMYK pub fn swapfirst(&self) -> bool { ((self.0 >> 14) & 1) != 0 } /// F: Flavor 0=MinIsBlack(Chocolate) 1=MinIsWhite(Vanilla) pub fn min_is_white(&self) -> bool { ((self.0 >> 13) & 1) != 0 } /// P: Planar? 0=Chunky, 1=Planar pub fn planar(&self) -> bool { ((self.0 >> 12) & 1) != 0 } /// X: swap 16 bps endianness? pub fn endian16(&self) -> bool { ((self.0 >> 11) & 1) != 0 } /// S: Do swap? ie, BGR, KYMC pub fn doswap(&self) -> bool { ((self.0 >> 10) & 1) != 0 } /// E: Extra samples pub fn extra(&self) -> usize { ((self.0 >> 7) & 7) as usize } /// C: Channels (Samples per pixel) pub fn channels(&self) -> usize { ((self.0 >> 3) & 15) as usize } /// B: bytes per sample pub fn bytes_per_channel(&self) -> usize { (self.0 & 7) as usize } /// size of pixel pub fn bytes_per_pixel(&self) -> usize { self.bytes_per_channel() * (self.extra() + self.channels()) } } #[test] fn test_pixelformat() { assert_eq!(4, PixelFormat::CMYKA_8.channels()); assert_eq!(1, PixelFormat::CMYKA_8.extra()); assert!(!PixelFormat::CMYKA_8.doswap()); assert_eq!(1, PixelFormat::CMYKA_8.bytes_per_channel()); assert_eq!(5, PixelFormat::CMYKA_8.bytes_per_pixel()); assert_eq!(2, PixelFormat::CMYK_HALF_FLT.bytes_per_channel()); assert_eq!(PT_CMYK, PixelFormat::CMYK_HALF_FLT.pixel_type()); } #[repr(C)] #[derive(Copy, Clone, PartialEq)] #[derive(Debug)] pub struct CIEXYZ { pub X: f64, pub Y: f64, pub Z: f64, } impl Default for CIEXYZ { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy, Clone, PartialEq)] #[derive(Debug)] pub struct CIExyY { pub x: f64, pub y: f64, pub Y: f64, } impl Default for CIExyY { fn default() -> Self { CIExyY{x:0., y:0., Y:1.} } } #[repr(C)] #[derive(Copy, Clone, PartialEq)] #[derive(Debug)] pub struct CIELab { pub L: f64, pub a: f64, pub b: f64, } impl Default for CIELab { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy, Clone, PartialEq)] #[derive(Debug)] pub struct CIELCh { pub L: f64, pub C: f64, pub h: f64, } impl Default for CIELCh { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy, Clone, PartialEq)] #[derive(Debug)] pub struct JCh { pub J: f64, pub C: f64, pub h: f64, } impl Default for JCh { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy, Clone, PartialEq)] #[derive(Debug)] pub struct CIEXYZTRIPLE { pub Red: CIEXYZ, pub Green: CIEXYZ, pub Blue: CIEXYZ, } #[repr(C)] #[derive(Copy, Clone, PartialEq)] #[derive(Debug)] pub struct CIExyYTRIPLE { pub Red: CIExyY, pub Green: CIExyY, pub Blue: CIExyY, } /// Illuminant types for structs below #[derive(Copy, Clone, PartialEq, Eq, Hash)] #[repr(u32)] #[derive(Debug)] pub enum IlluminantType { UNKNOWN = 0x0000000, D50 = 0x0000001, D65 = 0x0000002, D93 = 0x0000003, F2 = 0x0000004, D55 = 0x0000005, A = 0x0000006, E = 0x0000007, F8 = 0x0000008, } #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] pub struct ICCMeasurementConditions { pub Observer: u32, pub Backing: CIEXYZ, pub Geometry: u32, pub Flare: f64, pub IlluminantType: IlluminantType, } impl Default for ICCMeasurementConditions { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] pub struct ICCViewingConditions { pub IlluminantXYZ: CIEXYZ, pub SurroundXYZ: CIEXYZ, pub IlluminantType: IlluminantType, } impl Default for ICCViewingConditions { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(u32)] #[derive(Copy, Clone, Eq, PartialEq)] #[derive(Debug)] pub enum Surround { Avg = 1, Dim = 2, Dark = 3, Cutsheet = 4, } pub const D_CALCULATE: f64 = -1.; #[repr(C)] pub struct _cmsContext_struct { _opaque_type: [u8; 0] } // Each context holds its owns globals and its own plug-ins. There is a global context with the id = 0 for lecacy compatibility // though using the global context is not recommended. Proper context handling makes lcms more thread-safe. pub type Context = *mut _cmsContext_struct; pub type LogErrorHandlerFunction = ::std::option::Option<unsafe extern "C" fn(ContextID: Context, ErrorCode: u32, Text: *const c_char)>; #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] pub struct ViewingConditions { pub whitePoint: CIEXYZ, pub Yb: f64, pub La: f64, pub surround: Surround, pub D_value: f64, } impl Default for ViewingConditions { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] /// This describes a curve segment. /// /// For a table of supported types, see the manual. User can increase the number of /// available types by using a proper plug-in. Parametric segments allow 10 parameters at most pub struct CurveSegment { pub x0: f32, pub x1: f32, pub Type: i32, pub Params: [f64; 10], pub nGridPoints: u32, pub SampledPoints: *mut f32, } impl Default for CurveSegment { fn default() -> Self { unsafe { mem::zeroed() } } } pub enum ToneCurve { } pub enum Pipeline { } pub enum Stage { } #[derive(Copy, Clone, PartialEq, Eq)] #[repr(u32)] #[derive(Debug)] /// Where to place/locate the stages in the pipeline chain pub enum StageLoc { AT_BEGIN = 0, AT_END = 1, } pub type SAMPLER16 = unsafe extern "C" fn(input: *const u16, output: *mut u16, user_data: *mut c_void) -> i32; pub type SAMPLERFLOAT = unsafe extern "C" fn(input: *const f32, output: *mut f32, user_data: *mut c_void) -> i32; #[repr(C)] pub struct MLU { _opaque_type: [u8; 0] } #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] pub struct UcrBg { pub Ucr: *mut ToneCurve, pub Bg: *mut ToneCurve, pub Desc: *mut MLU, } pub const PRINTER_DEFAULT_SCREENS: u32 = 0x0001; pub const FREQUENCE_UNITS_LINES_CM: u32 = 0x0000; pub const FREQUENCE_UNITS_LINES_INCH: u32 = 0x0002; #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] pub enum SpotShape { UNKNOWN = 0, PRINTER_DEFAULT = 1, ROUND = 2, DIAMOND = 3, ELLIPSE = 4, LINE = 5, SQUARE = 6, CROSS = 7, } #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] pub struct ScreeningChannel { pub Frequency: f64, pub ScreenAngle: f64, pub SpotShape: SpotShape, } impl Default for ScreeningChannel { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] pub struct Screening { pub Flag: u32, pub nChannels: u32, pub Channels: [ScreeningChannel; 16], } impl Default for Screening { fn default() -> Self { unsafe { mem::zeroed() } } } #[repr(C)] pub struct NAMEDCOLORLIST { _opaque_type: [u8; 0] } #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] /// Profile sequence descriptor. /// /// Some fields come from profile sequence descriptor tag, others /// come from Profile Sequence Identifier Tag pub struct PSEQDESC { pub deviceMfg: Signature, pub deviceModel: Signature, pub attributes: u64, pub technology: TechnologySignature, pub ProfileID: ProfileID, pub Manufacturer: *mut MLU, pub Model: *mut MLU, pub Description: *mut MLU, } #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] pub struct SEQ { pub n: u32, pub ContextID: Context, pub seq: *mut PSEQDESC, } pub const EmbeddedProfileFalse: u32 = 0x00000000; pub const EmbeddedProfileTrue: u32 = 0x00000001; pub const UseAnywhere: u32 = 0x00000000; pub const UseWithEmbeddedDataOnly: u32 = 0x00000002; #[repr(C)] #[derive(Copy, Clone)] #[derive(Debug)] pub struct DICTentry { pub Next: *mut DICTentry, pub DisplayName: *mut MLU, pub DisplayValue: *mut MLU, pub Name: *mut wchar_t, pub Value: *mut wchar_t, } #[derive(Copy, Clone, PartialEq, Eq, Hash)] #[repr(u32)] #[derive(Debug)] pub enum InfoType { Description = 0, Manufacturer = 1, Model = 2, Copyright = 3, } #[repr(C)] pub struct IOHANDLER { _opaque_type: [u8; 0] } #[derive(Copy, Clone, PartialEq, Eq, Hash)] #[repr(u32)] #[derive(Debug)] pub enum Intent { /// ICC Intents Perceptual = 0, RelativeColorimetric = 1, Saturation = 2, AbsoluteColorimetric = 3, /// non-icc intents PreserveKOnlyPerceptual = 10, PreserveKOnlyRelativeColorimetric = 11, PreserveKOnlySaturation = 12, PreserveKPlanePerceptual = 13, PreserveKPlaneRelativeColorimetric = 14, PreserveKPlaneSaturation = 15, } // Flags /// Inhibit 1-pixel cache pub const FLAGS_NOCACHE: u32 = 0x0040; /// Inhibit optimizations pub const FLAGS_NOOPTIMIZE: u32 = 0x0100; /// Don't transform anyway pub const FLAGS_NULLTRANSFORM: u32 = 0x0200; /// Proofing flags /// Out of Gamut alarm pub const FLAGS_GAMUTCHECK: u32 = 0x1000; /// Do softproofing pub const FLAGS_SOFTPROOFING: u32 = 0x4000; // Misc pub const FLAGS_BLACKPOINTCOMPENSATION: u32 = 0x2000; /// Don't fix scum dot pub const FLAGS_NOWHITEONWHITEFIXUP: u32 = 0x0004; /// Use more memory to give better accurancy pub const FLAGS_HIGHRESPRECALC: u32 = 0x0400; /// Use less memory to minimize resources pub const FLAGS_LOWRESPRECALC: u32 = 0x0800; /// For devicelink creation /// Create 8 bits devicelinks pub const FLAGS_8BITS_DEVICELINK: u32 = 0x0008; /// Guess device class (for transform2devicelink) pub const FLAGS_GUESSDEVICECLASS: u32 = 0x0020; /// Keep profile sequence for devicelink creation pub const FLAGS_KEEP_SEQUENCE: u32 = 0x0080; /// Specific to a particular optimizations /// Force CLUT optimization pub const FLAGS_FORCE_CLUT: u32 = 0x0002; /// create postlinearization tables if possible pub const FLAGS_CLUT_POST_LINEARIZATION: u32 = 0x0001; /// create prelinearization tables if possible pub const FLAGS_CLUT_PRE_LINEARIZATION: u32 = 0x0010; /// Specific to unbounded mode /// Prevent negative numbers in floating point transforms pub const FLAGS_NONEGATIVES: u32 = 0x8000; /// Alpha channels are copied on `cmsDoTransform()` pub const FLAGS_COPY_ALPHA: u32 = 0x04000000; // Fine-tune control over number of gridpoints pub fn FLAGS_GRIDPOINTS(n: u32) -> u32 { ((n) & 0xFF) << 16 } /// CRD special pub const FLAGS_NODEFAULTRESOURCEDEF: u32 = 0x01000000; /// Use this flag to prevent changes being written to destination. pub const SAMPLER_INSPECT: u32 = 0x01000000; #[derive(Copy, Clone, PartialEq, Eq)] #[repr(u32)] #[derive(Debug)] pub enum PSResourceType { PS_RESOURCE_CSA = 0, PS_RESOURCE_CRD = 1, } extern "C" { pub fn cmsGetEncodedCMMversion() -> c_int; pub fn cmsstrcasecmp(s1: *const c_char, s2: *const c_char) -> c_int; pub fn cmsfilelength(f: *mut FILE) -> c_long; pub fn cmsCreateContext(Plugin: *mut c_void, UserData: *mut c_void) -> Context; pub fn cmsDeleteContext(ContexID: Context); pub fn cmsDupContext(ContextID: Context, NewUserData: *mut c_void) -> Context; pub fn cmsGetContextUserData(ContextID: Context) -> *mut c_void; pub fn cmsPlugin(Plugin: *mut c_void) -> Bool; pub fn cmsPluginTHR(ContextID: Context, Plugin: *mut c_void) -> Bool; pub fn cmsUnregisterPlugins(); pub fn cmsUnregisterPluginsTHR(ContextID: Context); pub fn cmsSetLogErrorHandler(Fn: LogErrorHandlerFunction); pub fn cmsSetLogErrorHandlerTHR(ContextID: Context, Fn: LogErrorHandlerFunction); pub fn cmsD50_XYZ() -> &'static CIEXYZ; pub fn cmsD50_xyY() -> &'static CIExyY; pub fn cmsXYZ2xyY(Dest: *mut CIExyY, Source: *const CIEXYZ); pub fn cmsxyY2XYZ(Dest: *mut CIEXYZ, Source: *const CIExyY); pub fn cmsXYZ2Lab(WhitePoint: *const CIEXYZ, Lab: *mut CIELab, xyz: *const CIEXYZ); pub fn cmsLab2XYZ(WhitePoint: *const CIEXYZ, xyz: *mut CIEXYZ, Lab: *const CIELab); pub fn cmsLab2LCh(LCh: *mut CIELCh, Lab: *const CIELab); pub fn cmsLCh2Lab(Lab: *mut CIELab, LCh: *const CIELCh); pub fn cmsLabEncoded2Float(Lab: *mut CIELab, wLab: *const u16); pub fn cmsLabEncoded2FloatV2(Lab: *mut CIELab, wLab: *const u16); pub fn cmsFloat2LabEncoded(wLab: *mut u16, Lab: *const CIELab); pub fn cmsFloat2LabEncodedV2(wLab: *mut u16, Lab: *const CIELab); pub fn cmsXYZEncoded2Float(fxyz: *mut CIEXYZ, XYZ: *const u16); pub fn cmsFloat2XYZEncoded(XYZ: *mut u16, fXYZ: *const CIEXYZ); pub fn cmsDeltaE(Lab1: *const CIELab, Lab2: *const CIELab) -> f64; pub fn cmsCIE94DeltaE(Lab1: *const CIELab, Lab2: *const CIELab) -> f64; pub fn cmsBFDdeltaE(Lab1: *const CIELab, Lab2: *const CIELab) -> f64; pub fn cmsCMCdeltaE(Lab1: *const CIELab, Lab2: *const CIELab, l: f64, c: f64) -> f64; pub fn cmsCIE2000DeltaE(Lab1: *const CIELab, Lab2: *const CIELab, Kl: f64, Kc: f64, Kh: f64) -> f64; pub fn cmsWhitePointFromTemp(WhitePoint: *mut CIExyY, TempK: f64) -> Bool; pub fn cmsTempFromWhitePoint(TempK: *mut f64, WhitePoint: *const CIExyY) -> Bool; pub fn cmsAdaptToIlluminant(Result: *mut CIEXYZ, SourceWhitePt: *const CIEXYZ, Illuminant: *const CIEXYZ, Value: *const CIEXYZ) -> Bool; pub fn cmsCIECAM02Init(ContextID: Context, pVC: *const ViewingConditions) -> HANDLE; pub fn cmsCIECAM02Done(hModel: HANDLE); pub fn cmsCIECAM02Forward(hModel: HANDLE, pIn: *const CIEXYZ, pOut: *mut JCh); pub fn cmsCIECAM02Reverse(hModel: HANDLE, pIn: *const JCh, pOut: *mut CIEXYZ); pub fn cmsBuildSegmentedToneCurve(ContextID: Context, nSegments: u32, Segments: *const CurveSegment) -> *mut ToneCurve; pub fn cmsBuildParametricToneCurve(ContextID: Context, Type: i32, Params: *const f64) -> *mut ToneCurve; pub fn cmsBuildGamma(ContextID: Context, Gamma: f64) -> *mut ToneCurve; pub fn cmsBuildTabulatedToneCurve16(ContextID: Context, nEntries: u32, values: *const u16) -> *mut ToneCurve; pub fn cmsBuildTabulatedToneCurveFloat(ContextID: Context, nEntries: u32, values: *const f32) -> *mut ToneCurve; pub fn cmsFreeToneCurve(Curve: *mut ToneCurve); pub fn cmsFreeToneCurveTriple(Curve: *mut *mut ToneCurve); pub fn cmsDupToneCurve(Src: *const ToneCurve) -> *mut ToneCurve; pub fn cmsReverseToneCurve(InGamma: *const ToneCurve) -> *mut ToneCurve; pub fn cmsReverseToneCurveEx(nResultSamples: u32, InGamma: *const ToneCurve) -> *mut ToneCurve; pub fn cmsJoinToneCurve(ContextID: Context, X: *const ToneCurve, Y: *const ToneCurve, nPoints: u32) -> *mut ToneCurve; pub fn cmsSmoothToneCurve(Tab: *mut ToneCurve, lambda: f64) -> Bool; pub fn cmsEvalToneCurveFloat(Curve: *const ToneCurve, v: f32) -> f32; pub fn cmsEvalToneCurve16(Curve: *const ToneCurve, v: u16) -> u16; pub fn cmsIsToneCurveMultisegment(InGamma: *const ToneCurve) -> Bool; pub fn cmsIsToneCurveLinear(Curve: *const ToneCurve) -> Bool; pub fn cmsIsToneCurveMonotonic(t: *const ToneCurve) -> Bool; pub fn cmsIsToneCurveDescending(t: *const ToneCurve) -> Bool; pub fn cmsGetToneCurveParametricType(t: *const ToneCurve) -> i32; pub fn cmsEstimateGamma(t: *const ToneCurve, Precision: f64) -> f64; pub fn cmsGetToneCurveEstimatedTableEntries(t: *const ToneCurve) -> u32; pub fn cmsGetToneCurveEstimatedTable(t: *const ToneCurve) -> *const u16; pub fn cmsPipelineAlloc(ContextID: Context, InputChannels: u32, OutputChannels: u32) -> *mut Pipeline; pub fn cmsPipelineFree(lut: *mut Pipeline); pub fn cmsPipelineDup(Orig: *const Pipeline) -> *mut Pipeline; pub fn cmsGetPipelineContextID(lut: *const Pipeline) -> Context; pub fn cmsPipelineInputChannels(lut: *const Pipeline) -> u32; pub fn cmsPipelineOutputChannels(lut: *const Pipeline) -> u32; pub fn cmsPipelineStageCount(lut: *const Pipeline) -> u32; pub fn cmsPipelineGetPtrToFirstStage(lut: *const Pipeline) -> *mut Stage; pub fn cmsPipelineGetPtrToLastStage(lut: *const Pipeline) -> *mut Stage; pub fn cmsPipelineEval16(In: *const u16, Out: *mut u16, lut: *const Pipeline); pub fn cmsPipelineEvalFloat(In: *const f32, Out: *mut f32, lut: *const Pipeline); pub fn cmsPipelineEvalReverseFloat(Target: *mut f32, Result: *mut f32, Hint: *mut f32, lut: *const Pipeline) -> Bool; pub fn cmsPipelineCat(l1: *mut Pipeline, l2: *const Pipeline) -> Bool; pub fn cmsPipelineSetSaveAs8bitsFlag(lut: *mut Pipeline, On: Bool) -> Bool; pub fn cmsPipelineInsertStage(lut: *mut Pipeline, loc: StageLoc, mpe: *mut Stage) -> bool; pub fn cmsPipelineUnlinkStage(lut: *mut Pipeline, loc: StageLoc, mpe: *mut *mut Stage); /// This function is quite useful to analyze the structure of a Pipeline and retrieve the Stage elements /// that conform the Pipeline. /// /// It should be called with the Pipeline, the number of expected elements and /// then a list of expected types followed with a list of double pointers to Stage elements. If /// the function founds a match with current pipeline, it fills the pointers and returns TRUE /// if not, returns FALSE without touching anything. pub fn cmsPipelineCheckAndRetreiveStages(Lut: *const Pipeline, n: u32, ...) -> Bool; pub fn cmsStageAllocIdentity(ContextID: Context, nChannels: u32) -> *mut Stage; pub fn cmsStageAllocToneCurves(ContextID: Context, nChannels: u32, Curves: *const *const ToneCurve) -> *mut Stage; pub fn cmsStageAllocMatrix(ContextID: Context, Rows: u32, Cols: u32, Matrix: *const f64, Offset: *const f64) -> *mut Stage; pub fn cmsStageAllocCLut16bit(ContextID: Context, nGridPoints: u32, inputChan: u32, outputChan: u32, Table: *const u16) -> *mut Stage; pub fn cmsStageAllocCLutFloat(ContextID: Context, nGridPoints: u32, inputChan: u32, outputChan: u32, Table: *const f32) -> *mut Stage; pub fn cmsStageAllocCLut16bitGranular(ContextID: Context, clutPoints: *const u32, inputChan: u32, outputChan: u32, Table: *const u16) -> *mut Stage; pub fn cmsStageAllocCLutFloatGranular(ContextID: Context, clutPoints: *const u32, inputChan: u32, outputChan: u32, Table: *const f32) -> *mut Stage; pub fn cmsStageDup(mpe: *mut Stage) -> *mut Stage; pub fn cmsStageFree(mpe: *mut Stage); pub fn cmsStageNext(mpe: *const Stage) -> *mut Stage; pub fn cmsStageInputChannels(mpe: *const Stage) -> u32; pub fn cmsStageOutputChannels(mpe: *const Stage) -> u32; pub fn cmsStageType(mpe: *const Stage) -> StageSignature; pub fn cmsStageData(mpe: *const Stage) -> *mut c_void; pub fn cmsStageSampleCLut16bit(mpe: *mut Stage, Sampler: SAMPLER16, Cargo: *mut c_void, dwFlags: u32) -> Bool; pub fn cmsStageSampleCLutFloat(mpe: *mut Stage, Sampler: SAMPLERFLOAT, Cargo: *mut c_void, dwFlags: u32) -> Bool; pub fn cmsSliceSpace16(nInputs: u32, clutPoints: *const u32, Sampler: SAMPLER16, Cargo: *mut c_void) -> Bool; pub fn cmsSliceSpaceFloat(nInputs: u32, clutPoints: *const u32, Sampler: SAMPLERFLOAT, Cargo: *mut c_void) -> Bool; pub fn cmsMLUalloc(ContextID: Context, nItems: u32) -> *mut MLU; pub fn cmsMLUfree(mlu: *mut MLU); pub fn cmsMLUdup(mlu: *const MLU) -> *mut MLU; pub fn cmsMLUsetASCII(mlu: *mut MLU, LanguageCode: *const c_char, CountryCode: *const c_char, ASCIIString: *const c_char) -> Bool; pub fn cmsMLUsetWide(mlu: *mut MLU, LanguageCode: *const c_char, CountryCode: *const c_char, WideString: *const wchar_t) -> Bool; pub fn cmsMLUgetASCII(mlu: *const MLU, LanguageCode: *const c_char, CountryCode: *const c_char, Buffer: *mut c_char, BufferSize: u32) -> u32; pub fn cmsMLUgetWide(mlu: *const MLU, LanguageCode: *const c_char, CountryCode: *const c_char, Buffer: *mut wchar_t, BufferSize: u32) -> u32; pub fn cmsMLUgetTranslation(mlu: *const MLU, LanguageCode: *const c_char, CountryCode: *const c_char, ObtainedLanguage: *mut c_char, ObtainedCountry: *mut c_char) -> Bool; pub fn cmsMLUtranslationsCount(mlu: *const MLU) -> u32; pub fn cmsMLUtranslationsCodes(mlu: *const MLU, idx: u32, LanguageCode: *mut c_char, CountryCode: *mut c_char) -> Bool; pub fn cmsAllocNamedColorList(ContextID: Context, n: u32, ColorantCount: u32, Prefix: *const c_char, Suffix: *const c_char) -> *mut NAMEDCOLORLIST; pub fn cmsFreeNamedColorList(v: *mut NAMEDCOLORLIST); pub fn cmsDupNamedColorList(v: *const NAMEDCOLORLIST) -> *mut NAMEDCOLORLIST; pub fn cmsAppendNamedColor(v: *mut NAMEDCOLORLIST, Name: *const c_char, PCS: *mut u16, Colorant: *mut u16) -> Bool; pub fn cmsNamedColorCount(v: *const NAMEDCOLORLIST) -> u32; pub fn cmsNamedColorIndex(v: *const NAMEDCOLORLIST, Name: *const c_char) -> i32; pub fn cmsNamedColorInfo(NamedColorList: *const NAMEDCOLORLIST, nColor: u32, Name: *mut c_char, Prefix: *mut c_char, Suffix: *mut c_char, PCS: *mut u16, Colorant: *mut u16) -> Bool; pub fn cmsGetNamedColorList(xform: HTRANSFORM) -> *mut NAMEDCOLORLIST; pub fn cmsAllocProfileSequenceDescription(ContextID: Context, n: u32) -> *mut SEQ; pub fn cmsDupProfileSequenceDescription(pseq: *const SEQ) -> *mut SEQ; pub fn cmsFreeProfileSequenceDescription(pseq: *mut SEQ); pub fn cmsDictAlloc(ContextID: Context) -> HANDLE; pub fn cmsDictFree(hDict: HANDLE); pub fn cmsDictDup(hDict: HANDLE) -> HANDLE; pub fn cmsDictAddEntry(hDict: HANDLE, Name: *const wchar_t, Value: *const wchar_t, DisplayName: *const MLU, DisplayValue: *const MLU) -> Bool; pub fn cmsDictGetEntryList(hDict: HANDLE) -> *const DICTentry; pub fn cmsDictNextEntry(e: *const DICTentry) -> *const DICTentry; pub fn cmsCreateProfilePlaceholder(ContextID: Context) -> HPROFILE; pub fn cmsGetProfileContextID(hProfile: HPROFILE) -> Context; pub fn cmsGetTagCount(hProfile: HPROFILE) -> i32; pub fn cmsGetTagSignature(hProfile: HPROFILE, n: u32) -> TagSignature; pub fn cmsIsTag(hProfile: HPROFILE, sig: TagSignature) -> Bool; pub fn cmsReadTag(hProfile: HPROFILE, sig: TagSignature) -> *mut c_void; pub fn cmsWriteTag(hProfile: HPROFILE, sig: TagSignature, data: *const c_void) -> Bool; pub fn cmsLinkTag(hProfile: HPROFILE, sig: TagSignature, dest: TagSignature) -> Bool; pub fn cmsTagLinkedTo(hProfile: HPROFILE, sig: TagSignature) -> TagSignature; pub fn cmsReadRawTag(hProfile: HPROFILE, sig: TagSignature, Buffer: *mut c_void, BufferSize: u32) -> u32; pub fn cmsWriteRawTag(hProfile: HPROFILE, sig: TagSignature, data: *const c_void, Size: u32) -> Bool; pub fn cmsGetHeaderFlags(hProfile: HPROFILE) -> u32; pub fn cmsGetHeaderAttributes(hProfile: HPROFILE, Flags: *mut u64); pub fn cmsGetHeaderProfileID(hProfile: HPROFILE, ProfileID: *mut u8); pub fn cmsGetHeaderCreationDateTime(hProfile: HPROFILE, Dest: *mut tm) -> Bool; pub fn cmsGetHeaderRenderingIntent(hProfile: HPROFILE) -> Intent; pub fn cmsSetHeaderFlags(hProfile: HPROFILE, Flags: u32); pub fn cmsGetHeaderManufacturer(hProfile: HPROFILE) -> u32; pub fn cmsSetHeaderManufacturer(hProfile: HPROFILE, manufacturer: u32); pub fn cmsGetHeaderCreator(hProfile: HPROFILE) -> u32; pub fn cmsGetHeaderModel(hProfile: HPROFILE) -> u32; pub fn cmsSetHeaderModel(hProfile: HPROFILE, model: u32); pub fn cmsSetHeaderAttributes(hProfile: HPROFILE, Flags: u64); pub fn cmsSetHeaderProfileID(hProfile: HPROFILE, ProfileID: *mut u8); pub fn cmsSetHeaderRenderingIntent(hProfile: HPROFILE, RenderingIntent: Intent); pub fn cmsGetPCS(hProfile: HPROFILE) -> ColorSpaceSignature; pub fn cmsSetPCS(hProfile: HPROFILE, pcs: ColorSpaceSignature); pub fn cmsGetColorSpace(hProfile: HPROFILE) -> ColorSpaceSignature; pub fn cmsSetColorSpace(hProfile: HPROFILE, sig: ColorSpaceSignature); pub fn cmsGetDeviceClass(hProfile: HPROFILE) -> ProfileClassSignature; pub fn cmsSetDeviceClass(hProfile: HPROFILE, sig: ProfileClassSignature); pub fn cmsSetProfileVersion(hProfile: HPROFILE, Version: f64); pub fn cmsGetProfileVersion(hProfile: HPROFILE) -> f64; pub fn cmsGetEncodedICCversion(hProfile: HPROFILE) -> u32; pub fn cmsSetEncodedICCversion(hProfile: HPROFILE, Version: u32); pub fn cmsIsIntentSupported(hProfile: HPROFILE, Intent: Intent, UsedDirection: u32) -> Bool; pub fn cmsIsMatrixShaper(hProfile: HPROFILE) -> Bool; pub fn cmsIsCLUT(hProfile: HPROFILE, Intent: Intent, UsedDirection: u32) -> Bool; pub fn _cmsICCcolorSpace(OurNotation: c_int) -> ColorSpaceSignature; pub fn _cmsLCMScolorSpace(ProfileSpace: ColorSpaceSignature) -> c_int; pub fn cmsChannelsOf(ColorSpace: ColorSpaceSignature) -> u32; pub fn cmsFormatterForColorspaceOfProfile(hProfile: HPROFILE, nBytes: u32, lIsFloat: Bool) -> u32; pub fn cmsFormatterForPCSOfProfile(hProfile: HPROFILE, nBytes: u32, lIsFloat: Bool) -> u32; pub fn cmsGetProfileInfo(hProfile: HPROFILE, Info: InfoType, LanguageCode: *const c_char, CountryCode: *const c_char, Buffer: *mut wchar_t, BufferSize: u32) -> u32; pub fn cmsGetProfileInfoASCII(hProfile: HPROFILE, Info: InfoType, LanguageCode: *const c_char, CountryCode: *const c_char, Buffer: *mut c_char, BufferSize: u32) -> u32; pub fn cmsOpenIOhandlerFromFile(ContextID: Context, FileName: *const c_char, AccessMode: *const c_char) -> *mut IOHANDLER; pub fn cmsOpenIOhandlerFromStream(ContextID: Context, Stream: *mut FILE) -> *mut IOHANDLER; pub fn cmsOpenIOhandlerFromMem(ContextID: Context, Buffer: *mut c_void, size: u32, AccessMode: *const c_char) -> *mut IOHANDLER; pub fn cmsOpenIOhandlerFromNULL(ContextID: Context) -> *mut IOHANDLER; pub fn cmsGetProfileIOhandler(hProfile: HPROFILE) -> *mut IOHANDLER; pub fn cmsCloseIOhandler(io: *mut IOHANDLER) -> Bool; pub fn cmsMD5computeID(hProfile: HPROFILE) -> Bool; pub fn cmsOpenProfileFromFile(ICCProfile: *const c_char, sAccess: *const c_char) -> HPROFILE; pub fn cmsOpenProfileFromFileTHR(ContextID: Context, ICCProfile: *const c_char, sAccess: *const c_char) -> HPROFILE; pub fn cmsOpenProfileFromStream(ICCProfile: *mut FILE, sAccess: *const c_char) -> HPROFILE; pub fn cmsOpenProfileFromStreamTHR(ContextID: Context, ICCProfile: *mut FILE, sAccess: *const c_char) -> HPROFILE; pub fn cmsOpenProfileFromMem(MemPtr: *const c_void, dwSize: u32) -> HPROFILE; pub fn cmsOpenProfileFromMemTHR(ContextID: Context, MemPtr: *const c_void, dwSize: u32) -> HPROFILE; pub fn cmsOpenProfileFromIOhandlerTHR(ContextID: Context, io: *mut IOHANDLER) -> HPROFILE; pub fn cmsOpenProfileFromIOhandler2THR(ContextID: Context, io: *mut IOHANDLER, write: Bool) -> HPROFILE; pub fn cmsCloseProfile(hProfile: HPROFILE) -> Bool; pub fn cmsSaveProfileToFile(hProfile: HPROFILE, FileName: *const c_char) -> Bool; pub fn cmsSaveProfileToStream(hProfile: HPROFILE, Stream: *mut FILE) -> Bool; pub fn cmsSaveProfileToMem(hProfile: HPROFILE, MemPtr: *mut c_void, BytesNeeded: *mut u32) -> Bool; pub fn cmsSaveProfileToIOhandler(hProfile: HPROFILE, io: *mut IOHANDLER) -> u32; pub fn cmsCreateRGBProfileTHR(ContextID: Context, WhitePoint: *const CIExyY, Primaries: *const CIExyYTRIPLE, TransferFunction: *const *const ToneCurve) -> HPROFILE; pub fn cmsCreateRGBProfile(WhitePoint: *const CIExyY, Primaries: *const CIExyYTRIPLE, TransferFunction: *const *const ToneCurve) -> HPROFILE; pub fn cmsCreateGrayProfileTHR(ContextID: Context, WhitePoint: *const CIExyY, TransferFunction: *const ToneCurve) -> HPROFILE; pub fn cmsCreateGrayProfile(WhitePoint: *const CIExyY, TransferFunction: *const ToneCurve) -> HPROFILE; pub fn cmsCreateLinearizationDeviceLinkTHR(ContextID: Context, ColorSpace: ColorSpaceSignature, TransferFunctions: *const *const ToneCurve) -> HPROFILE; pub fn cmsCreateLinearizationDeviceLink(ColorSpace: ColorSpaceSignature, TransferFunctions: *const *const ToneCurve) -> HPROFILE; pub fn cmsCreateInkLimitingDeviceLinkTHR(ContextID: Context, ColorSpace: ColorSpaceSignature, Limit: f64) -> HPROFILE; pub fn cmsCreateInkLimitingDeviceLink(ColorSpace: ColorSpaceSignature, Limit: f64) -> HPROFILE; pub fn cmsCreateLab2ProfileTHR(ContextID: Context, WhitePoint: *const CIExyY) -> HPROFILE; pub fn cmsCreateLab2Profile(WhitePoint: *const CIExyY) -> HPROFILE; pub fn cmsCreateLab4ProfileTHR(ContextID: Context, WhitePoint: *const CIExyY) -> HPROFILE; pub fn cmsCreateLab4Profile(WhitePoint: *const CIExyY) -> HPROFILE; pub fn cmsCreateXYZProfileTHR(ContextID: Context) -> HPROFILE; pub fn cmsCreateXYZProfile() -> HPROFILE; pub fn cmsCreate_sRGBProfileTHR(ContextID: Context) -> HPROFILE; pub fn cmsCreate_sRGBProfile() -> HPROFILE; pub fn cmsCreateBCHSWabstractProfileTHR(ContextID: Context, nLUTPoints: u32, Bright: f64, Contrast: f64, Hue: f64, Saturation: f64, TempSrc: u32, TempDest: u32) -> HPROFILE; pub fn cmsCreateBCHSWabstractProfile(nLUTPoints: u32, Bright: f64, Contrast: f64, Hue: f64, Saturation: f64, TempSrc: u32, TempDest: u32) -> HPROFILE; pub fn cmsCreateNULLProfileTHR(ContextID: Context) -> HPROFILE; pub fn cmsCreateNULLProfile() -> HPROFILE; pub fn cmsTransform2DeviceLink(hTransform: HTRANSFORM, Version: f64, dwFlags: u32) -> HPROFILE; pub fn cmsGetSupportedIntents(nMax: u32, Codes: *mut u32, Descriptions: *mut *mut c_char) -> u32; pub fn cmsGetSupportedIntentsTHR(ContextID: Context, nMax: u32, Codes: *mut u32, Descriptions: *mut *mut c_char) -> u32; pub fn cmsCreateTransformTHR(ContextID: Context, Input: HPROFILE, InputFormat: PixelFormat, Output: HPROFILE, OutputFormat: PixelFormat, Intent: Intent, dwFlags: u32) -> HTRANSFORM; pub fn cmsCreateTransform(Input: HPROFILE, InputFormat: PixelFormat, Output: HPROFILE, OutputFormat: PixelFormat, Intent: Intent, dwFlags: u32) -> HTRANSFORM; pub fn cmsCreateProofingTransformTHR(ContextID: Context, Input: HPROFILE, InputFormat: PixelFormat, Output: HPROFILE, OutputFormat: PixelFormat, Proofing: HPROFILE, Intent: Intent, ProofingIntent: Intent, dwFlags: u32) -> HTRANSFORM; pub fn cmsCreateProofingTransform(Input: HPROFILE, InputFormat: PixelFormat, Output: HPROFILE, OutputFormat: PixelFormat, Proofing: HPROFILE, Intent: Intent, ProofingIntent: Intent, dwFlags: u32) -> HTRANSFORM; pub fn cmsCreateMultiprofileTransformTHR(ContextID: Context, hProfiles: *mut HPROFILE, nProfiles: u32, InputFormat: PixelFormat, OutputFormat: PixelFormat, Intent: Intent, dwFlags: u32) -> HTRANSFORM; pub fn cmsCreateMultiprofileTransform(hProfiles: *mut HPROFILE, nProfiles: u32, InputFormat: PixelFormat, OutputFormat: PixelFormat, Intent: Intent, dwFlags: u32) -> HTRANSFORM; pub fn cmsCreateExtendedTransform(ContextID: Context, nProfiles: u32, hProfiles: *mut HPROFILE, BPC: *mut Bool, Intents: *mut u32, AdaptationStates: *mut f64, hGamutProfile: HPROFILE, nGamutPCSposition: u32, InputFormat: PixelFormat, OutputFormat: PixelFormat, dwFlags: u32) -> HTRANSFORM; pub fn cmsDeleteTransform(hTransform: HTRANSFORM); pub fn cmsDoTransform(Transform: HTRANSFORM, InputBuffer: *const c_void, OutputBuffer: *mut c_void, Size: u32); /// Deprecated pub fn cmsDoTransformStride(Transform: HTRANSFORM, InputBuffer: *const c_void, OutputBuffer: *mut c_void, Size: u32, Stride: u32); pub fn cmsDoTransformLineStride(Transform: HTRANSFORM, InputBuffer: *const c_void, OutputBuffer: *mut c_void, PixelsPerLine: u32, LineCount: u32, BytesPerLineIn: u32, BytesPerLineOut: u32, BytesPerPlaneIn: u32, BytesPerPlaneOut: u32); pub fn cmsSetAlarmCodes(NewAlarm: *const u16); pub fn cmsGetAlarmCodes(NewAlarm: *mut u16); pub fn cmsSetAlarmCodesTHR(ContextID: Context, AlarmCodes: *const u16); pub fn cmsGetAlarmCodesTHR(ContextID: Context, AlarmCodes: *mut u16); pub fn cmsSetAdaptationState(d: f64) -> f64; pub fn cmsSetAdaptationStateTHR(ContextID: Context, d: f64) -> f64; pub fn cmsGetTransformContextID(hTransform: HTRANSFORM) -> Context; pub fn cmsGetTransformInputFormat(hTransform: HTRANSFORM) -> PixelFormat; pub fn cmsGetTransformOutputFormat(hTransform: HTRANSFORM) -> PixelFormat; pub fn cmsChangeBuffersFormat(hTransform: HTRANSFORM, InputFormat: PixelFormat, OutputFormat: PixelFormat) -> Bool; pub fn cmsGetPostScriptColorResource(ContextID: Context, Type: PSResourceType, hProfile: HPROFILE, Intent: Intent, dwFlags: u32, io: *mut IOHANDLER) -> u32; pub fn cmsGetPostScriptCSA(ContextID: Context, hProfile: HPROFILE, Intent: Intent, dwFlags: u32, Buffer: *mut c_void, dwBufferLen: u32) -> u32; pub fn cmsGetPostScriptCRD(ContextID: Context, hProfile: HPROFILE, Intent: Intent, dwFlags: u32, Buffer: *mut c_void, dwBufferLen: u32) -> u32; pub fn cmsIT8Alloc(ContextID: Context) -> HANDLE; pub fn cmsIT8Free(hIT8: HANDLE); pub fn cmsIT8TableCount(hIT8: HANDLE) -> u32; pub fn cmsIT8SetTable(hIT8: HANDLE, nTable: u32) -> i32; pub fn cmsIT8LoadFromFile(ContextID: Context, cFileName: *const c_char) -> HANDLE; pub fn cmsIT8LoadFromMem(ContextID: Context, Ptr: *const c_void, len: u32) -> HANDLE; pub fn cmsIT8SaveToFile(hIT8: HANDLE, cFileName: *const c_char) -> Bool; pub fn cmsIT8SaveToMem(hIT8: HANDLE, MemPtr: *mut c_void, BytesNeeded: *mut u32) -> Bool; pub fn cmsIT8GetSheetType(hIT8: HANDLE) -> *const c_char; pub fn cmsIT8SetSheetType(hIT8: HANDLE, Type: *const c_char) -> Bool; pub fn cmsIT8SetComment(hIT8: HANDLE, cComment: *const c_char) -> Bool; pub fn cmsIT8SetPropertyStr(hIT8: HANDLE, cProp: *const c_char, Str: *const c_char) -> Bool; pub fn cmsIT8SetPropertyDbl(hIT8: HANDLE, cProp: *const c_char, Val: f64) -> Bool; pub fn cmsIT8SetPropertyHex(hIT8: HANDLE, cProp: *const c_char, Val: u32) -> Bool; pub fn cmsIT8SetPropertyMulti(hIT8: HANDLE, Key: *const c_char, SubKey: *const c_char, Buffer: *const c_char) -> Bool; pub fn cmsIT8SetPropertyUncooked(hIT8: HANDLE, Key: *const c_char, Buffer: *const c_char) -> Bool; pub fn cmsIT8GetProperty(hIT8: HANDLE, cProp: *const c_char) -> *const c_char; pub fn cmsIT8GetPropertyDbl(hIT8: HANDLE, cProp: *const c_char) -> f64; pub fn cmsIT8GetPropertyMulti(hIT8: HANDLE, Key: *const c_char, SubKey: *const c_char) -> *const c_char; pub fn cmsIT8EnumProperties(hIT8: HANDLE, PropertyNames: *mut *mut *mut c_char) -> u32; pub fn cmsIT8EnumPropertyMulti(hIT8: HANDLE, cProp: *const c_char, SubpropertyNames: *mut *mut *const c_char) -> u32; pub fn cmsIT8GetDataRowCol(hIT8: HANDLE, row: c_int, col: c_int) -> *const c_char; pub fn cmsIT8GetDataRowColDbl(hIT8: HANDLE, row: c_int, col: c_int) -> f64; pub fn cmsIT8SetDataRowCol(hIT8: HANDLE, row: c_int, col: c_int, Val: *const c_char) -> Bool; pub fn cmsIT8SetDataRowColDbl(hIT8: HANDLE, row: c_int, col: c_int, Val: f64) -> Bool; pub fn cmsIT8GetData(hIT8: HANDLE, cPatch: *const c_char, cSample: *const c_char) -> *const c_char; pub fn cmsIT8GetDataDbl(hIT8: HANDLE, cPatch: *const c_char, cSample: *const c_char) -> f64; pub fn cmsIT8SetData(hIT8: HANDLE, cPatch: *const c_char, cSample: *const c_char, Val: *const c_char) -> Bool; pub fn cmsIT8SetDataDbl(hIT8: HANDLE, cPatch: *const c_char, cSample: *const c_char, Val: f64) -> Bool; pub fn cmsIT8FindDataFormat(hIT8: HANDLE, cSample: *const c_char) -> c_int; pub fn cmsIT8SetDataFormat(hIT8: HANDLE, n: c_int, Sample: *const c_char) -> Bool; pub fn cmsIT8EnumDataFormat(hIT8: HANDLE, SampleNames: *mut *mut *mut c_char) -> c_int; pub fn cmsIT8GetPatchName(hIT8: HANDLE, nPatch: c_int, buffer: *mut c_char) -> *const c_char; pub fn cmsIT8GetPatchByName(hIT8: HANDLE, cPatch: *const c_char) -> c_int; pub fn cmsIT8SetTableByLabel(hIT8: HANDLE, cSet: *const c_char, cField: *const c_char, ExpectedType: *const c_char) -> c_int; pub fn cmsIT8SetIndexColumn(hIT8: HANDLE, cSample: *const c_char) -> Bool; pub fn cmsIT8DefineDblFormat(hIT8: HANDLE, Formatter: *const c_char); pub fn cmsGBDAlloc(ContextID: Context) -> HANDLE; pub fn cmsGBDFree(hGBD: HANDLE); pub fn cmsGDBAddPoint(hGBD: HANDLE, Lab: *const CIELab) -> Bool; pub fn cmsGDBCompute(hGDB: HANDLE, dwFlags: u32) -> Bool; pub fn cmsGDBCheckPoint(hGBD: HANDLE, Lab: *const CIELab) -> Bool; pub fn cmsDetectBlackPoint(BlackPoint: *mut CIEXYZ, hProfile: HPROFILE, Intent: Intent, dwFlags: u32) -> Bool; pub fn cmsDetectDestinationBlackPoint(BlackPoint: *mut CIEXYZ, hProfile: HPROFILE, Intent: Intent, dwFlags: u32) -> Bool; // Estimate total area coverage pub fn cmsDetectTAC(hProfile: HPROFILE) -> f64; pub fn cmsDesaturateLab(Lab: *mut CIELab, amax: f64, amin: f64, bmax: f64, bmin: f64) -> Bool; }
//! Object Protocol //! https://docs.python.org/3/c-api/object.html use crate::{ builtins::{ pystr::AsPyStr, PyBytes, PyDict, PyDictRef, PyGenericAlias, PyInt, PyStr, PyStrRef, PyTuple, PyTupleRef, PyType, PyTypeRef, }, bytesinner::ByteInnerNewOptions, common::{hash::PyHash, str::to_ascii}, convert::{ToPyObject, ToPyResult}, dictdatatype::DictKey, function::{Either, OptionalArg, PyArithmeticValue, PySetterValue}, protocol::{PyIter, PyMapping, PySequence}, types::{Constructor, PyComparisonOp}, AsObject, Py, PyObject, PyObjectRef, PyResult, TryFromObject, VirtualMachine, }; // RustPython doesn't need these items // PyObject *Py_NotImplemented // Py_RETURN_NOTIMPLEMENTED impl PyObjectRef { // int PyObject_Print(PyObject *o, FILE *fp, int flags) // PyObject *PyObject_GenericGetDict(PyObject *o, void *context) // int PyObject_GenericSetDict(PyObject *o, PyObject *value, void *context) #[inline(always)] pub fn rich_compare(self, other: Self, opid: PyComparisonOp, vm: &VirtualMachine) -> PyResult { self._cmp(&other, opid, vm).map(|res| res.to_pyobject(vm)) } pub fn bytes(self, vm: &VirtualMachine) -> PyResult { let bytes_type = vm.ctx.types.bytes_type; match self.downcast_exact::<PyInt>(vm) { Ok(int) => Err(vm.new_downcast_type_error(bytes_type, &int)), Err(obj) => PyBytes::py_new( bytes_type.to_owned(), ByteInnerNewOptions { source: OptionalArg::Present(obj), encoding: OptionalArg::Missing, errors: OptionalArg::Missing, }, vm, ), } } // const hash_not_implemented: fn(&PyObject, &VirtualMachine) ->PyResult<PyHash> = crate::types::Unhashable::slot_hash; pub fn is_true(self, vm: &VirtualMachine) -> PyResult<bool> { self.try_to_bool(vm) } pub fn not(self, vm: &VirtualMachine) -> PyResult<bool> { self.is_true(vm).map(|x| !x) } pub fn length_hint(self, defaultvalue: usize, vm: &VirtualMachine) -> PyResult<usize> { Ok(vm.length_hint_opt(self)?.unwrap_or(defaultvalue)) } // PyObject *PyObject_Dir(PyObject *o) } impl PyObject { /// Takes an object and returns an iterator for it. /// This is typically a new iterator but if the argument is an iterator, this /// returns itself. pub fn get_iter(&self, vm: &VirtualMachine) -> PyResult<PyIter> { // PyObject_GetIter PyIter::try_from_object(vm, self.to_owned()) } // PyObject *PyObject_GetAIter(PyObject *o) pub fn has_attr<'a>(&self, attr_name: impl AsPyStr<'a>, vm: &VirtualMachine) -> PyResult<bool> { self.get_attr(attr_name, vm).map(|o| !vm.is_none(&o)) } pub fn get_attr<'a>(&self, attr_name: impl AsPyStr<'a>, vm: &VirtualMachine) -> PyResult { let attr_name = attr_name.as_pystr(&vm.ctx); self.get_attr_inner(attr_name, vm) } // get_attribute should be used for full attribute access (usually from user code). #[cfg_attr(feature = "flame-it", flame("PyObjectRef"))] #[inline] pub(crate) fn get_attr_inner(&self, attr_name: &Py<PyStr>, vm: &VirtualMachine) -> PyResult { vm_trace!("object.__getattribute__: {:?} {:?}", self, attr_name); let getattro = self .class() .mro_find_map(|cls| cls.slots.getattro.load()) .unwrap(); getattro(self, attr_name, vm).map_err(|exc| { vm.set_attribute_error_context(&exc, self.to_owned(), attr_name.to_owned()); exc }) } pub fn call_set_attr( &self, vm: &VirtualMachine, attr_name: &Py<PyStr>, attr_value: PySetterValue, ) -> PyResult<()> { let setattro = { let cls = self.class(); cls.mro_find_map(|cls| cls.slots.setattro.load()) .ok_or_else(|| { let has_getattr = cls.mro_find_map(|cls| cls.slots.getattro.load()).is_some(); vm.new_type_error(format!( "'{}' object has {} attributes ({} {})", cls.name(), if has_getattr { "only read-only" } else { "no" }, if attr_value.is_assign() { "assign to" } else { "del" }, attr_name )) })? }; setattro(self, attr_name, attr_value, vm) } pub fn set_attr<'a>( &self, attr_name: impl AsPyStr<'a>, attr_value: impl Into<PyObjectRef>, vm: &VirtualMachine, ) -> PyResult<()> { let attr_name = attr_name.as_pystr(&vm.ctx); let attr_value = attr_value.into(); self.call_set_attr(vm, attr_name, PySetterValue::Assign(attr_value)) } // int PyObject_GenericSetAttr(PyObject *o, PyObject *name, PyObject *value) #[cfg_attr(feature = "flame-it", flame)] pub fn generic_setattr( &self, attr_name: &Py<PyStr>, value: PySetterValue, vm: &VirtualMachine, ) -> PyResult<()> { vm_trace!("object.__setattr__({:?}, {}, {:?})", self, attr_name, value); if let Some(attr) = vm .ctx .interned_str(attr_name) .and_then(|attr_name| self.get_class_attr(attr_name)) { let descr_set = attr.class().mro_find_map(|cls| cls.slots.descr_set.load()); if let Some(descriptor) = descr_set { return descriptor(&attr, self.to_owned(), value, vm); } } if let Some(dict) = self.dict() { if let PySetterValue::Assign(value) = value { dict.set_item(attr_name, value, vm)?; } else { dict.del_item(attr_name, vm).map_err(|e| { if e.fast_isinstance(vm.ctx.exceptions.key_error) { vm.new_attribute_error(format!( "'{}' object has no attribute '{}'", self.class().name(), attr_name.as_str(), )) } else { e } })?; } Ok(()) } else { Err(vm.new_attribute_error(format!( "'{}' object has no attribute '{}'", self.class().name(), attr_name.as_str(), ))) } } pub fn generic_getattr(&self, name: &Py<PyStr>, vm: &VirtualMachine) -> PyResult { self.generic_getattr_opt(name, None, vm)?.ok_or_else(|| { vm.new_attribute_error(format!( "'{}' object has no attribute '{}'", self.class().name(), name )) }) } /// CPython _PyObject_GenericGetAttrWithDict pub fn generic_getattr_opt( &self, name_str: &Py<PyStr>, dict: Option<PyDictRef>, vm: &VirtualMachine, ) -> PyResult<Option<PyObjectRef>> { let name = name_str.as_str(); let obj_cls = self.class(); let cls_attr_name = vm.ctx.interned_str(name_str); let cls_attr = match cls_attr_name.and_then(|name| obj_cls.get_attr(name)) { Some(descr) => { let descr_cls = descr.class(); let descr_get = descr_cls.mro_find_map(|cls| cls.slots.descr_get.load()); if let Some(descr_get) = descr_get { if descr_cls .mro_find_map(|cls| cls.slots.descr_set.load()) .is_some() { let cls = obj_cls.to_owned().into(); return descr_get(descr, Some(self.to_owned()), Some(cls), vm).map(Some); } } Some((descr, descr_get)) } None => None, }; let dict = dict.or_else(|| self.dict()); let attr = if let Some(dict) = dict { dict.get_item_opt(name, vm)? } else { None }; if let Some(obj_attr) = attr { Ok(Some(obj_attr)) } else if let Some((attr, descr_get)) = cls_attr { match descr_get { Some(descr_get) => { let cls = obj_cls.to_owned().into(); descr_get(attr, Some(self.to_owned()), Some(cls), vm).map(Some) } None => Ok(Some(attr)), } } else { Ok(None) } } pub fn del_attr<'a>(&self, attr_name: impl AsPyStr<'a>, vm: &VirtualMachine) -> PyResult<()> { let attr_name = attr_name.as_pystr(&vm.ctx); self.call_set_attr(vm, attr_name, PySetterValue::Delete) } // Perform a comparison, raising TypeError when the requested comparison // operator is not supported. // see: CPython PyObject_RichCompare #[inline] // called by ExecutingFrame::execute_compare with const op fn _cmp( &self, other: &Self, op: PyComparisonOp, vm: &VirtualMachine, ) -> PyResult<Either<PyObjectRef, bool>> { let swapped = op.swapped(); let call_cmp = |obj: &PyObject, other: &PyObject, op| { let cmp = obj .class() .mro_find_map(|cls| cls.slots.richcompare.load()) .unwrap(); let r = match cmp(obj, other, op, vm)? { Either::A(obj) => PyArithmeticValue::from_object(vm, obj).map(Either::A), Either::B(arithmetic) => arithmetic.map(Either::B), }; Ok(r) }; let mut checked_reverse_op = false; let is_strict_subclass = { let self_class = self.class(); let other_class = other.class(); !self_class.is(other_class) && other_class.fast_issubclass(self_class) }; if is_strict_subclass { let res = vm.with_recursion("in comparison", || call_cmp(other, self, swapped))?; checked_reverse_op = true; if let PyArithmeticValue::Implemented(x) = res { return Ok(x); } } if let PyArithmeticValue::Implemented(x) = vm.with_recursion("in comparison", || call_cmp(self, other, op))? { return Ok(x); } if !checked_reverse_op { let res = vm.with_recursion("in comparison", || call_cmp(other, self, swapped))?; if let PyArithmeticValue::Implemented(x) = res { return Ok(x); } } match op { PyComparisonOp::Eq => Ok(Either::B(self.is(&other))), PyComparisonOp::Ne => Ok(Either::B(!self.is(&other))), _ => Err(vm.new_unsupported_binop_error(self, other, op.operator_token())), } } #[inline(always)] pub fn rich_compare_bool( &self, other: &Self, opid: PyComparisonOp, vm: &VirtualMachine, ) -> PyResult<bool> { match self._cmp(other, opid, vm)? { Either::A(obj) => obj.try_to_bool(vm), Either::B(other) => Ok(other), } } pub fn repr(&self, vm: &VirtualMachine) -> PyResult<PyStrRef> { vm.with_recursion("while getting the repr of an object", || { match self.class().slots.repr.load() { Some(slot) => slot(self, vm), None => vm .call_special_method(self, identifier!(vm, __repr__), ())? .try_into_value(vm), // TODO: remove magic method call once __repr__ is fully ported to slot } }) } pub fn ascii(&self, vm: &VirtualMachine) -> PyResult<ascii::AsciiString> { let repr = self.repr(vm)?; let ascii = to_ascii(repr.as_str()); Ok(ascii) } // Container of the virtual machine state: pub fn str(&self, vm: &VirtualMachine) -> PyResult<PyStrRef> { let obj = match self.to_owned().downcast_exact::<PyStr>(vm) { Ok(s) => return Ok(s.into_pyref()), Err(obj) => obj, }; // TODO: replace to obj.class().slots.str let str_method = match vm.get_special_method(&obj, identifier!(vm, __str__))? { Some(str_method) => str_method, None => return obj.repr(vm), }; let s = str_method.invoke((), vm)?; s.downcast::<PyStr>().map_err(|obj| { vm.new_type_error(format!( "__str__ returned non-string (type {})", obj.class().name() )) }) } // Equivalent to check_class. Masks Attribute errors (into TypeErrors) and lets everything // else go through. fn check_cls<F>(&self, cls: &PyObject, vm: &VirtualMachine, msg: F) -> PyResult where F: Fn() -> String, { cls.get_attr(identifier!(vm, __bases__), vm).map_err(|e| { // Only mask AttributeErrors. if e.class().is(vm.ctx.exceptions.attribute_error) { vm.new_type_error(msg()) } else { e } }) } fn abstract_issubclass(&self, cls: &PyObject, vm: &VirtualMachine) -> PyResult<bool> { let mut derived = self; let mut first_item: PyObjectRef; loop { if derived.is(cls) { return Ok(true); } let bases = derived.get_attr(identifier!(vm, __bases__), vm)?; let tuple = PyTupleRef::try_from_object(vm, bases)?; let n = tuple.len(); match n { 0 => { return Ok(false); } 1 => { first_item = tuple.fast_getitem(0).clone(); derived = &first_item; continue; } _ => { if let Some(i) = (0..n).next() { let check = vm.with_recursion("in abstract_issubclass", || { tuple.fast_getitem(i).abstract_issubclass(cls, vm) })?; if check { return Ok(true); } } } } return Ok(false); } } fn recursive_issubclass(&self, cls: &PyObject, vm: &VirtualMachine) -> PyResult<bool> { if let (Ok(obj), Ok(cls)) = (self.try_to_ref::<PyType>(vm), cls.try_to_ref::<PyType>(vm)) { Ok(obj.fast_issubclass(cls)) } else { self.check_cls(self, vm, || { format!("issubclass() arg 1 must be a class, not {}", self.class()) }) .and(self.check_cls(cls, vm, || { format!( "issubclass() arg 2 must be a class, a tuple of classes, or a union, not {}", cls.class() ) })) .and(self.abstract_issubclass(cls, vm)) } } /// Determines if `self` is a subclass of `cls`, either directly, indirectly or virtually /// via the __subclasscheck__ magic method. pub fn is_subclass(&self, cls: &PyObject, vm: &VirtualMachine) -> PyResult<bool> { if cls.class().is(vm.ctx.types.type_type) { if self.is(cls) { return Ok(true); } return self.recursive_issubclass(cls, vm); } if let Ok(tuple) = cls.try_to_value::<&Py<PyTuple>>(vm) { for typ in tuple { if vm.with_recursion("in __subclasscheck__", || self.is_subclass(typ, vm))? { return Ok(true); } } return Ok(false); } if let Some(meth) = vm.get_special_method(cls, identifier!(vm, __subclasscheck__))? { let ret = vm.with_recursion("in __subclasscheck__", || { meth.invoke((self.to_owned(),), vm) })?; return ret.try_to_bool(vm); } self.recursive_issubclass(cls, vm) } fn abstract_isinstance(&self, cls: &PyObject, vm: &VirtualMachine) -> PyResult<bool> { let r = if let Ok(typ) = cls.try_to_ref::<PyType>(vm) { if self.class().fast_issubclass(typ) { true } else if let Ok(icls) = PyTypeRef::try_from_object(vm, self.get_attr(identifier!(vm, __class__), vm)?) { if icls.is(self.class()) { false } else { icls.fast_issubclass(typ) } } else { false } } else { self.check_cls(cls, vm, || { format!( "isinstance() arg 2 must be a type or tuple of types, not {}", cls.class() ) })?; let icls: PyObjectRef = self.get_attr(identifier!(vm, __class__), vm)?; if vm.is_none(&icls) { false } else { icls.abstract_issubclass(cls, vm)? } }; Ok(r) } /// Determines if `self` is an instance of `cls`, either directly, indirectly or virtually via /// the __instancecheck__ magic method. pub fn is_instance(&self, cls: &PyObject, vm: &VirtualMachine) -> PyResult<bool> { // cpython first does an exact check on the type, although documentation doesn't state that // https://github.com/python/cpython/blob/a24107b04c1277e3c1105f98aff5bfa3a98b33a0/Objects/abstract.c#L2408 if self.class().is(cls) { return Ok(true); } if cls.class().is(vm.ctx.types.type_type) { return self.abstract_isinstance(cls, vm); } if let Ok(tuple) = cls.try_to_ref::<PyTuple>(vm) { for typ in tuple { if vm.with_recursion("in __instancecheck__", || self.is_instance(typ, vm))? { return Ok(true); } } return Ok(false); } if let Some(meth) = vm.get_special_method(cls, identifier!(vm, __instancecheck__))? { let ret = vm.with_recursion("in __instancecheck__", || { meth.invoke((self.to_owned(),), vm) })?; return ret.try_to_bool(vm); } self.abstract_isinstance(cls, vm) } pub fn hash(&self, vm: &VirtualMachine) -> PyResult<PyHash> { let hash = self.get_class_attr(identifier!(vm, __hash__)).unwrap(); if vm.is_none(&hash) { return Err(vm.new_exception_msg( vm.ctx.exceptions.type_error.to_owned(), format!("unhashable type: '{}'", self.class().name()), )); } let hash = self .class() .mro_find_map(|cls| cls.slots.hash.load()) .unwrap(); hash(self, vm) } // type protocol // PyObject *PyObject_Type(PyObject *o) // int PyObject_TypeCheck(PyObject *o, PyTypeObject *type) pub fn length_opt(&self, vm: &VirtualMachine) -> Option<PyResult<usize>> { self.to_sequence(vm) .length_opt(vm) .or_else(|| self.to_mapping().length_opt(vm)) } pub fn length(&self, vm: &VirtualMachine) -> PyResult<usize> { self.length_opt(vm).ok_or_else(|| { vm.new_type_error(format!( "object of type '{}' has no len()", self.class().name() )) })? } pub fn get_item<K: DictKey + ?Sized>(&self, needle: &K, vm: &VirtualMachine) -> PyResult { if let Some(dict) = self.downcast_ref_if_exact::<PyDict>(vm) { return dict.get_item(needle, vm); } let needle = needle.to_pyobject(vm); if let Ok(mapping) = PyMapping::try_protocol(self, vm) { mapping.subscript(&needle, vm) } else if let Ok(seq) = PySequence::try_protocol(self, vm) { let i = needle.key_as_isize(vm)?; seq.get_item(i, vm) } else { if self.class().fast_issubclass(vm.ctx.types.type_type) { if self.is(vm.ctx.types.type_type) { return PyGenericAlias::new(self.class().to_owned(), needle, vm) .to_pyresult(vm); } if let Some(class_getitem) = vm.get_attribute_opt(self.to_owned(), identifier!(vm, __class_getitem__))? { return class_getitem.call((needle,), vm); } } Err(vm.new_type_error(format!("'{}' object is not subscriptable", self.class()))) } } pub fn set_item<K: DictKey + ?Sized>( &self, needle: &K, value: PyObjectRef, vm: &VirtualMachine, ) -> PyResult<()> { if let Some(dict) = self.downcast_ref_if_exact::<PyDict>(vm) { return dict.set_item(needle, value, vm); } let mapping = self.to_mapping(); if let Some(f) = mapping.methods.ass_subscript.load() { let needle = needle.to_pyobject(vm); return f(mapping, &needle, Some(value), vm); } let seq = self.to_sequence(vm); if let Some(f) = seq.methods.ass_item.load() { let i = needle.key_as_isize(vm)?; return f(seq, i, Some(value), vm); } Err(vm.new_type_error(format!( "'{}' does not support item assignment", self.class() ))) } pub fn del_item<K: DictKey + ?Sized>(&self, needle: &K, vm: &VirtualMachine) -> PyResult<()> { if let Some(dict) = self.downcast_ref_if_exact::<PyDict>(vm) { return dict.del_item(needle, vm); } let mapping = self.to_mapping(); if let Some(f) = mapping.methods.ass_subscript.load() { let needle = needle.to_pyobject(vm); return f(mapping, &needle, None, vm); } let seq = self.to_sequence(vm); if let Some(f) = seq.methods.ass_item.load() { let i = needle.key_as_isize(vm)?; return f(seq, i, None, vm); } Err(vm.new_type_error(format!("'{}' does not support item deletion", self.class()))) } }
// Copyright 2019-2020 PolkaX. Licensed under MIT or Apache-2.0. use std::str::FromStr; use bytes::Bytes; use cid::{Cid, Codec, ExtCode}; use either::Either; use minicbor::{encode, Encoder}; use serde::ser; use block_format::{BasicBlock, Block}; use ipld_format::{FormatError, Link, Node, NodeStat, Resolver}; use crate::error::IpldCoreError; use crate::value::IpldValue; /// `IpldNode` represents an IPLD node. #[derive(Debug, Clone, PartialEq)] pub struct IpldNode { obj: IpldValue, tree: Vec<String>, links: Vec<Link>, raw: Bytes, cid: Cid, } impl IpldNode { fn new_with_obj<B: Block>(block: &B, obj: IpldValue) -> Result<Self, IpldCoreError> { let (tree, links) = compute(&obj)?; Ok(Self { obj, tree, links, raw: block.raw_data().clone(), cid: block.cid().clone(), }) } /// Deserialize a CBOR object into an IPLD Node. /// /// Equivalent to the `Decode` in `go-ipld-cbor` pub fn from_cbor(cbor: &[u8], hash_type: ExtCode) -> Result<Self, IpldCoreError> { let value = minicbor::decode::<IpldValue>(cbor)?; println!("Value: {:?}", value); Self::wrap_object(&value, hash_type) } /// Serialize the object of IPLD Node into its CBOR serialized byte representation. pub fn to_cbor(&self) -> Result<Vec<u8>, IpldCoreError> { Ok(minicbor::to_vec(&self.obj)?) } /// Deserialize the JSON object into IPLD Node. pub fn from_json(json: &str, hash_type: ExtCode) -> Result<Self, IpldCoreError> { let value = serde_json::from_str::<IpldValue>(json)?; Self::wrap_object(&value, hash_type) } /// Serialize the object of IPLD Node into its json string representation. pub fn to_json(&self) -> Result<String, IpldCoreError> { Ok(serde_json::to_string(&self.obj)?) } /// Convert an CBOR object into IPLD Node. pub fn wrap_object<T: minicbor::Encode>( value: &T, hash_type: ExtCode, ) -> Result<Self, IpldCoreError> { let data = minicbor::to_vec(value)?; // println!("{:?}", data); let value = minicbor::decode::<IpldValue>(&data)?; let hash = hash_type.digest(&data); // println!("Hash: {:?}", hash.as_bytes()); let cid = Cid::new_v1(Codec::DagCBOR, hash); let block = BasicBlock::new_with_cid(data.into(), cid)?; Self::new_with_obj(&block, value) } /// Decode a CBOR encoded Block into an IPLD Node. /// /// In general, you should not be calling this method directly. /// Instead, you should be calling the `from_cbor` or `from_json`` method. pub fn from_block<B: Block>(block: &B) -> Result<Self, IpldCoreError> { let value = minicbor::decode::<IpldValue>(block.raw_data())?; Self::new_with_obj(block, value) } /// Returns obj of the IPLD Node. pub fn obj(&self) -> &IpldValue { &self.obj } } // Implement JSON serialization for IpldNode. // Equivalent to the `to_json` of `IpldNode`. impl ser::Serialize for IpldNode { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: ser::Serializer, { self.obj.serialize(serializer) } } // Implement CBOR serialization for IpldNode. // Equivalent to the `to_cbor` of `IpldNode`. impl encode::Encode for IpldNode { fn encode<W: encode::Write>(&self, e: &mut Encoder<W>) -> Result<(), encode::Error<W::Error>> { e.encode(&self.obj)?.ok() } } impl Block for IpldNode { fn raw_data(&self) -> &Bytes { &self.raw } } impl AsRef<Cid> for IpldNode { fn as_ref(&self) -> &Cid { &self.cid } } impl Resolver for IpldNode { type Output = Either<Link, IpldValue>; /// Resolve resolves a given path, and returns the object found at the end, as well /// as the possible tail of the path that was not resolved. fn resolve(&self, path: &[&str]) -> ipld_format::Result<(Self::Output, Vec<String>)> { let mut cur = &self.obj; for (index, val) in path.iter().enumerate() { match cur { IpldValue::Map(m) => { cur = m.get::<str>(val).ok_or_else(|| { FormatError::Other(Box::new(IpldCoreError::NoSuchLink((*val).to_string()))) })?; } IpldValue::List(arr) => { let index = usize::from_str(val).map_err(|e| FormatError::Other(Box::new(e)))?; cur = arr.get(index).ok_or_else(|| { FormatError::Other(Box::new(IpldCoreError::NoSuchLink(format!( "array index out of range[{}]", index )))) })?; } IpldValue::Link(cid) => { let link = Link::new_with_cid(cid.clone()); return Ok(( Either::Left(link), path.iter().skip(index).map(|s| (*s).to_string()).collect(), )); } _ => return Err(FormatError::Other(Box::new(IpldCoreError::NoLinks))), } } if let IpldValue::Link(cid) = cur { let link = Link::new_with_cid(cid.clone()); return Ok((Either::Left(link), vec![])); } Ok((Either::Right(cur.clone()), vec![])) } /// Tree returns a flatten array of paths at the given path for the given depth. fn tree(&self, path: &str, depth: Option<usize>) -> Vec<String> { if path.is_empty() && depth.is_none() { return self.tree.clone(); } let mut out = vec![]; for t in &self.tree { if !t.starts_with(path) { continue; } // start from path length. // e.g. tree item like "123456/123", path is "123", then s would be "/123" // `skip_while` would ignore first chars until meet "/" // `skip_while` plus `trim_start_matches` would equal to `strings.TrimLeft` in GO // but `s` is allocated, use char.utf8_len to peek slice for `t` could avoid allocate. let skip = t.chars().skip(path.len()); // equal to `[len(path):]` let s: String = if !path.is_empty() { // only filter when path is not "", notice GO not impl for this! skip.skip_while(|c| *c != '/').collect() } else { skip.collect() }; // "/123/123" would be "123/123", "//123/123" would be "123/123" let sub = s.trim_start_matches('/'); if sub.is_empty() { // means current tree have no child continue; } match depth { None => { // means not filter by depth out.push(sub.to_string()); continue; } Some(dep) => { // for example sub like "123/123/123", and depth is 2, would not peek let parts = sub.split('/').collect::<Vec<_>>(); if parts.len() <= dep { out.push(sub.to_string()); } } } } out } } impl Node for IpldNode { fn resolve_link(&self, path: &[&str]) -> ipld_format::Result<(Link, Vec<String>)> { let (either, rest) = self.resolve(path)?; match either { Either::Left(link) => Ok((link, rest)), Either::Right(_) => Err(FormatError::Other(Box::new(IpldCoreError::NonLink))), } } fn links(&self) -> Vec<&Link> { self.links.iter().collect() } /// Stat returns stats about the Node. fn stat(&self) -> ipld_format::Result<&NodeStat> { // TODO: implement? unimplemented!() } // Size returns the size of the binary representation of the Node. fn size(&self) -> u64 { self.raw_data().len() as u64 } } fn compute(obj: &IpldValue) -> Result<(Vec<String>, Vec<Link>), IpldCoreError> { let mut tree = vec![]; let mut links = vec![]; let mut func = |name: &str, obj: &IpldValue| { if !name.is_empty() { // [1:] let name = name.chars().skip(1).collect::<String>(); tree.push(name); } if let IpldValue::Link(cid) = obj { links.push(Link::new_with_cid(cid.clone())) } Ok(()) }; traverse(obj, "", &mut func)?; Ok((tree, links)) } fn traverse<F>(obj: &IpldValue, cur: &str, f: &mut F) -> Result<(), IpldCoreError> where F: FnMut(&str, &IpldValue) -> Result<(), IpldCoreError>, { f(cur, obj)?; match obj { IpldValue::Map(m) => { for (k, v) in m.iter() { let this = format!("{}/{}", cur, k); traverse(v, &this, f)?; } Ok(()) } IpldValue::List(arr) => { for (i, v) in arr.iter().enumerate() { let this = format!("{}/{}", cur, i); traverse(v, &this, f)?; } Ok(()) } _ => Ok(()), } }
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // Tests for nested self-reference which caused a stack overflow. use std::fmt::Debug; use std::ops::*; fn gen() -> impl PartialOrd + PartialEq + Debug { } struct Bar {} trait Foo<T = Self> {} impl Foo for Bar {} fn foo() -> impl Foo { Bar {} } fn test_impl_ops() -> impl Add + Sub + Mul + Div { 1 } fn test_impl_assign_ops() -> impl AddAssign + SubAssign + MulAssign + DivAssign { 1 } fn main() {}
// Copyright 2019 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // http://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD // https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied, // modified, or distributed except according to those terms. Please review the Licences for the // specific language governing permissions and limitations relating to use of the SAFE Network // Software. //! FFI tools. //! //! We implement all primitive types that have been needed in SAFE projects so far. More can be //! implemented if needed, with the following exceptions, which should not be implemented: //! //! + `bool`: This doesn't seem to be safe to pass over the FFI directly. Should be converted to a //! type such as `u32` instead. //! + `char`: It's not clear why this would be necessary. You'd probably want to convert to `u32` //! for better ABI stability. //! + `i128` and `u128`: do not have a stable ABI, so they cannot be returned across the FFI. /// Trait to convert between FFI and Rust representations of types. pub trait ReprC { /// C representation of the type. type C; /// Error type. type Error; /// Convert from a raw FFI type into a native Rust type by cloning the data. /// /// # Safety /// /// The implementation of this function may be unsafe, as `repr_c` may be a raw pointer that /// needs to be valid. unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> where Self: Sized; } impl ReprC for i32 { type C = i32; type Error = (); unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> { Ok(repr_c) } } impl ReprC for i64 { type C = i64; type Error = (); unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> { Ok(repr_c) } } impl ReprC for u32 { type C = u32; type Error = (); unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> { Ok(repr_c) } } impl ReprC for u64 { type C = u64; type Error = (); unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> { Ok(repr_c) } } impl ReprC for usize { type C = usize; type Error = (); unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> { Ok(repr_c) } } impl<T> ReprC for *const T { type C = *const T; type Error = (); unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> { Ok(repr_c) } } impl<T> ReprC for *mut T { type C = *mut T; type Error = (); unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> { Ok(repr_c) } } // TODO: Replace these with a const generic implementation once it is stable. // https://github.com/rust-lang/rust/issues/44580 impl ReprC for [u8; 24] { type C = *const [u8; 24]; type Error = (); unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> { Ok(*repr_c) } } impl ReprC for [u8; 32] { type C = *const [u8; 32]; type Error = (); unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> { Ok(*repr_c) } } impl ReprC for [u8; 48] { type C = *const [u8; 48]; type Error = (); unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> { Ok(*repr_c) } } impl ReprC for [u8; 64] { type C = *const [u8; 64]; type Error = (); unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> { Ok(*repr_c) } } impl ReprC for [u8; 96] { type C = *const [u8; 96]; type Error = (); unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> { Ok(*repr_c) } } impl ReprC for bool { type C = u32; type Error = (); unsafe fn clone_from_repr_c(repr_c: Self::C) -> Result<Self, Self::Error> { Ok(repr_c != 0) } }
use std::path::Path; use crate::error::FileError; pub async fn read<S: AsRef<Path>>(path: S) -> Result<Vec<u8>, FileError> { macroquad::prelude::load_file(&path.as_ref().as_os_str().to_string_lossy()) .await .map_err(FileError::Engine) } pub async fn read_to_string<S: AsRef<Path>>(path: S) -> Result<String, FileError> { match read(path).await { Ok(bytes) => match String::from_utf8(bytes) { Ok(string) => Ok(string), Err(err) => Err(FileError::String(err)), }, Err(err) => Err(err), } }
use mod_int::ModInt998244353; use proconio::input; fn main() { input! { n: usize, m: usize, }; if 2_usize.saturating_pow((n - 1) as u32) > m { println!("0"); return; } assert!(n <= 60); // // prev_power_of_two // let p = if m.is_power_of_two() { // m // } else { // m.next_power_of_two() / 2 // }; let mut k = 0; for i in 0..60 { if m >> i & 1 == 1 { k = i; } } dbg!(k); assert!(2_usize.pow(k as u32) <= m); assert!(m < 2_usize.pow(k as u32 + 1)); type Mint = ModInt998244353; let mut dp = vec![Mint::new(0); k + 1]; for j in 0..k { // msb(*) = j dp[j] = Mint::new(2).pow(j); } dp[k] = Mint::from(m) - Mint::new(2).pow(k) + 1; for _ in 1..n { let mut nxt = vec![Mint::new(0); k + 1]; for j in 0..k { for t in (j + 1)..k { nxt[t] += dp[j] * 2_usize.pow(t as u32); } nxt[k] += dp[j] * (m - 2_usize.pow(k as u32) + 1); } dp = nxt; } let mut ans = Mint::new(0); for dp in dp { ans += dp; } println!("{}", ans.val()); }
pub struct Solution; impl Solution { pub fn is_happy(n: i32) -> bool { use std::collections::HashSet; let mut set = HashSet::new(); let mut n = n; loop { if n == 1 { return true; } n = next(n); let is_new = set.insert(n); if !is_new { return false; } } } } fn next(n: i32) -> i32 { let mut sum = 0; let mut n = n; while n > 0 { sum += (n % 10).pow(2); n /= 10; } sum } #[test] fn test0202() { fn case(n: i32, want: bool) { assert_eq!(Solution::is_happy(n), want); } case(19, true); }
use serde::{Serialize, Deserialize}; use std::fmt::Display; use std::io::Write; use std::net::TcpStream; use std::path::{Path, PathBuf}; use std::fs::{self, OpenOptions}; use nardol::bytes::{Bytes, FromBytes, IntoBytes}; use nardol::error::NetCommsErrorKind; use nardol::ron::FromRon; use nardol::{message::{ContentType}, packet::Packet, prelude::{ToRon, Message, NetCommsError}}; use crate::ImplementedMessage; use super::{message_kind::MessageKind, metadata::MetaData}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Content (String); impl Default for Content { fn default() -> Self { Self::new() } } impl FromRon<'_> for Content {} impl ToRon for Content {} impl Display for Content { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "Content({})", self.string_ref()) } } impl IntoBytes for Content { fn into_bytes(self) -> Bytes { Bytes::from_vec(self.0.into_bytes()) } } impl FromBytes for Content { fn from_bytes(bytes: Bytes) -> Result<Self, NetCommsError> where Self: Sized { Ok(Content::with_data(bytes.to_string())) } fn from_buff(buff: &[u8]) -> Result<Self, NetCommsError> where Self: Sized { todo!() } } impl ContentType<'_, MetaData, Content> for Content { fn send(self, stream: &mut TcpStream, metadata: MetaData) -> Result<(), NetCommsError> { match metadata.file_name() { Some(file_name) => { let path = Path::new(&file_name); ImplementedMessage::send_file(stream, path)?; } None => { let bytes = self.0.as_bytes().to_vec().into_bytes(); ImplementedMessage::send_content(stream, bytes)? }, } Ok(()) } fn receive(stream: &mut TcpStream, metadata: &MetaData, path: Option<PathBuf>) -> Result<(Self, Packet), NetCommsError> { let path = path.unwrap(); let path = metadata.get_message_location(&path); let (content, end_data) = match metadata.message_kind() { MessageKind::File => { let (_, end_data) = ImplementedMessage::receive_file( stream, &path, metadata .file_name() .unwrap() )?; (Content::new(), end_data) } _ => { let (bytes, end_data) = ImplementedMessage::receive_content(stream)?; let content = Content::with_data(bytes.to_string()); (content, end_data) } }; Ok((content, end_data)) } } impl Content { pub fn new() -> Self { Content(String::new()) } pub fn with_data(data: String) -> Self { Content(data) } pub fn append_string(&mut self, string: String) { for char in string.chars() { self.0.push(char); } } pub fn into_string(self) -> String { self.0 } pub fn string_ref<'a>(&'a self) -> &'a String { &self.0 } }
use std::path::Path; use tokio::{ fs::{self, OpenOptions}, io::AsyncWriteExt, }; use crate::env::*; pub async fn save(game_req: GameRequest, log_dir: &Path) { if !log_dir.exists() { fs::create_dir(&log_dir) .await .expect("Logging directory could not be created!"); } let filename = format!("{}.{}.json", game_req.game.id, game_req.you.id); let mut file = OpenOptions::new() .write(true) .create(true) .append(true) .open(log_dir.join(filename)) .await .expect("Could not create/open save game!"); let data = serde_json::to_vec(&game_req).unwrap(); file.write_all(&data).await.unwrap(); }
//! The Virtual Machine (VM) handles generating instructions, then executing them. //! This module will provide an instruction set for the AST to use, various traits, //! plus an interpreter to execute those instructions use crate::{ builtins::Array, environment::lexical_environment::VariableScope, symbol::WellKnownSymbols, BoaProfiler, Context, JsResult, JsValue, }; mod code_block; mod opcode; pub use code_block::CodeBlock; pub use opcode::Opcode; use std::{convert::TryInto, mem::size_of, time::Instant}; use self::code_block::Readable; /// Virtual Machine. #[derive(Debug)] pub struct Vm<'a> { context: &'a mut Context, pc: usize, code: CodeBlock, stack: Vec<JsValue>, stack_pointer: usize, is_trace: bool, } #[cfg(test)] mod tests; impl<'a> Vm<'a> { pub fn new(code: CodeBlock, context: &'a mut Context) -> Self { let trace = context.trace; Self { context, pc: 0, code, stack: Vec::with_capacity(128), stack_pointer: 0, is_trace: trace, } } /// Push a value on the stack. #[inline] pub fn push<T>(&mut self, value: T) where T: Into<JsValue>, { self.stack.push(value.into()); } /// Pop a value off the stack. /// /// # Panics /// /// If there is nothing to pop, then this will panic. #[inline] #[track_caller] pub fn pop(&mut self) -> JsValue { self.stack.pop().unwrap() } fn read<T: Readable>(&mut self) -> T { let value = self.code.read::<T>(self.pc); self.pc += size_of::<T>(); value } fn execute_instruction(&mut self) -> JsResult<()> { let _timer = BoaProfiler::global().start_event("execute_instruction", "vm"); macro_rules! bin_op { ($op:ident) => {{ let rhs = self.pop(); let lhs = self.pop(); let value = lhs.$op(&rhs, self.context)?; self.push(value) }}; } let opcode = self.code.code[self.pc].try_into().unwrap(); self.pc += 1; match opcode { Opcode::Nop => {} Opcode::Pop => { let _ = self.pop(); } Opcode::Dup => { let value = self.pop(); self.push(value.clone()); self.push(value); } Opcode::Swap => { let first = self.pop(); let second = self.pop(); self.push(first); self.push(second); } Opcode::PushUndefined => self.push(JsValue::undefined()), Opcode::PushNull => self.push(JsValue::null()), Opcode::PushTrue => self.push(true), Opcode::PushFalse => self.push(false), Opcode::PushZero => self.push(0), Opcode::PushOne => self.push(1), Opcode::PushInt8 => { let value = self.read::<i8>(); self.push(value as i32); } Opcode::PushInt16 => { let value = self.read::<i16>(); self.push(value as i32); } Opcode::PushInt32 => { let value = self.read::<i32>(); self.push(value); } Opcode::PushRational => { let value = self.read::<f64>(); self.push(value); } Opcode::PushNaN => self.push(JsValue::nan()), Opcode::PushPositiveInfinity => self.push(JsValue::positive_inifnity()), Opcode::PushNegativeInfinity => self.push(JsValue::negative_inifnity()), Opcode::PushLiteral => { let index = self.read::<u32>() as usize; let value = self.code.literals[index].clone(); self.push(value) } Opcode::PushEmptyObject => self.push(JsValue::new_object(self.context)), Opcode::PushNewArray => { let count = self.read::<u32>(); let mut elements = Vec::with_capacity(count as usize); for _ in 0..count { elements.push(self.pop()); } let array = Array::new_array(self.context); Array::add_to_array_object(&array, &elements, self.context)?; self.push(array); } Opcode::Add => bin_op!(add), Opcode::Sub => bin_op!(sub), Opcode::Mul => bin_op!(mul), Opcode::Div => bin_op!(div), Opcode::Pow => bin_op!(pow), Opcode::Mod => bin_op!(rem), Opcode::BitAnd => bin_op!(bitand), Opcode::BitOr => bin_op!(bitor), Opcode::BitXor => bin_op!(bitxor), Opcode::ShiftLeft => bin_op!(shl), Opcode::ShiftRight => bin_op!(shr), Opcode::UnsignedShiftRight => bin_op!(ushr), Opcode::Eq => { let rhs = self.pop(); let lhs = self.pop(); let value = lhs.equals(&rhs, self.context)?; self.push(value); } Opcode::NotEq => { let rhs = self.pop(); let lhs = self.pop(); let value = !lhs.equals(&rhs, self.context)?; self.push(value); } Opcode::StrictEq => { let rhs = self.pop(); let lhs = self.pop(); self.push(lhs.strict_equals(&rhs)); } Opcode::StrictNotEq => { let rhs = self.pop(); let lhs = self.pop(); self.push(!lhs.strict_equals(&rhs)); } Opcode::GreaterThan => bin_op!(gt), Opcode::GreaterThanOrEq => bin_op!(ge), Opcode::LessThan => bin_op!(lt), Opcode::LessThanOrEq => bin_op!(le), Opcode::In => { let rhs = self.pop(); let lhs = self.pop(); if !rhs.is_object() { return Err(self.context.construct_type_error(format!( "right-hand side of 'in' should be an object, got {}", rhs.type_of() ))); } let key = lhs.to_property_key(self.context)?; let has_property = self.context.has_property(&rhs, &key)?; self.push(has_property); } Opcode::InstanceOf => { let y = self.pop(); let x = self.pop(); let value = if let Some(object) = y.as_object() { let key = WellKnownSymbols::has_instance(); match object.get_method(self.context, key)? { Some(instance_of_handler) => instance_of_handler .call(&y, &[x], self.context)? .to_boolean(), None if object.is_callable() => { object.ordinary_has_instance(self.context, &x)? } None => { return Err(self.context.construct_type_error( "right-hand side of 'instanceof' is not callable", )); } } } else { return Err(self.context.construct_type_error(format!( "right-hand side of 'instanceof' should be an object, got {}", y.type_of() ))); }; self.push(value); } Opcode::Void => { let _ = self.pop(); self.push(JsValue::undefined()); } Opcode::TypeOf => { let value = self.pop(); self.push(value.type_of()); } Opcode::Pos => { let value = self.pop(); let value = value.to_number(self.context)?; self.push(value); } Opcode::Neg => { let value = self.pop().neg(self.context)?; self.push(value); } Opcode::LogicalNot => { let value = self.pop(); self.push(!value.to_boolean()); } Opcode::BitNot => { let target = self.pop(); let num = target.to_number(self.context)?; let value = if num.is_nan() { -1 } else { // TODO: this is not spec compliant. !(num as i32) }; self.push(value); } Opcode::DefVar => { let index = self.read::<u32>(); let name = &self.code.names[index as usize]; self.context .create_mutable_binding(name, false, VariableScope::Function)?; } Opcode::DefLet => { let index = self.read::<u32>(); let name = &self.code.names[index as usize]; self.context .create_mutable_binding(name, false, VariableScope::Block)?; } Opcode::DefConst => { let index = self.read::<u32>(); let name = &self.code.names[index as usize]; self.context.create_immutable_binding( name.as_ref(), false, VariableScope::Block, )?; } Opcode::InitLexical => { let index = self.read::<u32>(); let value = self.pop(); let name = &self.code.names[index as usize]; self.context.initialize_binding(name, value)?; } Opcode::GetName => { let index = self.read::<u32>(); let name = &self.code.names[index as usize]; let value = self.context.get_binding_value(name)?; self.push(value); } Opcode::SetName => { let index = self.read::<u32>(); let value = self.pop(); let name = &self.code.names[index as usize]; if self.context.has_binding(name)? { // Binding already exists self.context .set_mutable_binding(name, value, self.context.strict())?; } else { self.context .create_mutable_binding(name, true, VariableScope::Function)?; self.context.initialize_binding(name, value)?; } } Opcode::Jump => { let address = self.read::<u32>(); self.pc = address as usize; } Opcode::JumpIfFalse => { let address = self.read::<u32>(); if !self.pop().to_boolean() { self.pc = address as usize; } } Opcode::JumpIfTrue => { let address = self.read::<u32>(); if self.pop().to_boolean() { self.pc = address as usize; } } Opcode::LogicalAnd => { let exit = self.read::<u32>(); let lhs = self.pop(); if !lhs.to_boolean() { self.pc = exit as usize; self.push(false); } } Opcode::LogicalOr => { let exit = self.read::<u32>(); let lhs = self.pop(); if lhs.to_boolean() { self.pc = exit as usize; self.push(true); } } Opcode::Coalesce => { let exit = self.read::<u32>(); let lhs = self.pop(); if !lhs.is_null_or_undefined() { self.pc = exit as usize; self.push(lhs); } } Opcode::ToBoolean => { let value = self.pop(); self.push(value.to_boolean()); } Opcode::GetPropertyByName => { let index = self.read::<u32>(); let value = self.pop(); let object = if let Some(object) = value.as_object() { object } else { value.to_object(self.context)? }; let name = self.code.names[index as usize].clone(); let result = object.get(name, self.context)?; self.push(result) } Opcode::GetPropertyByValue => { let value = self.pop(); let key = self.pop(); let object = if let Some(object) = value.as_object() { object } else { value.to_object(self.context)? }; let key = key.to_property_key(self.context)?; let result = object.get(key, self.context)?; self.push(result) } Opcode::SetPropertyByName => { let index = self.read::<u32>(); let object = self.pop(); let value = self.pop(); let object = if let Some(object) = object.as_object() { object } else { object.to_object(self.context)? }; let name = self.code.names[index as usize].clone(); object.set(name, value, true, self.context)?; } Opcode::SetPropertyByValue => { let object = self.pop(); let key = self.pop(); let value = self.pop(); let object = if let Some(object) = object.as_object() { object } else { object.to_object(self.context)? }; let key = key.to_property_key(self.context)?; object.set(key, value, true, self.context)?; } Opcode::Throw => { let value = self.pop(); return Err(value); } Opcode::This => { let this = self.context.get_this_binding()?; self.push(this); } Opcode::Case => { let address = self.read::<u32>(); let cond = self.pop(); let value = self.pop(); if !value.strict_equals(&cond) { self.push(value); } else { self.pc = address as usize; } } Opcode::Default => { let exit = self.read::<u32>(); let _ = self.pop(); self.pc = exit as usize; } } Ok(()) } pub fn run(&mut self) -> JsResult<JsValue> { let _timer = BoaProfiler::global().start_event("run", "vm"); const COLUMN_WIDTH: usize = 24; const TIME_COLUMN_WIDTH: usize = COLUMN_WIDTH / 2; const OPCODE_COLUMN_WIDTH: usize = COLUMN_WIDTH; const OPERAND_COLUMN_WIDTH: usize = COLUMN_WIDTH; const NUMBER_OF_COLUMNS: usize = 4; if self.is_trace { println!("{}\n", self.code); println!( "{:-^width$}", " Vm Start ", width = COLUMN_WIDTH * NUMBER_OF_COLUMNS - 10 ); println!( "{:<time_width$} {:<opcode_width$} {:<operand_width$} Top Of Stack", "Time", "Opcode", "Operands", time_width = TIME_COLUMN_WIDTH, opcode_width = OPCODE_COLUMN_WIDTH, operand_width = OPERAND_COLUMN_WIDTH, ); } self.pc = 0; while self.pc < self.code.code.len() { if self.is_trace { let mut pc = self.pc; let instant = Instant::now(); self.execute_instruction()?; let duration = instant.elapsed(); let opcode: Opcode = self.code.read::<u8>(pc).try_into().unwrap(); println!( "{:<time_width$} {:<opcode_width$} {:<operand_width$} {}", format!("{}μs", duration.as_micros()), opcode.as_str(), self.code.instruction_operands(&mut pc), match self.stack.last() { None => "<empty>".to_string(), Some(value) => format!("{}", value.display()), }, time_width = TIME_COLUMN_WIDTH, opcode_width = OPCODE_COLUMN_WIDTH, operand_width = OPERAND_COLUMN_WIDTH, ); } else { self.execute_instruction()?; } } if self.is_trace { println!("\nStack:"); if !self.stack.is_empty() { for (i, value) in self.stack.iter().enumerate() { println!( "{:04}{:<width$} {}", i, "", value.display(), width = COLUMN_WIDTH / 2 - 4, ); } } else { println!(" <empty>"); } println!("\n"); } if self.stack.is_empty() { return Ok(JsValue::undefined()); } Ok(self.pop()) } }
use std::ops::Index; use crate::math::Vec3; use crate::graphics::Ray; #[derive(Clone, Copy, Debug)] pub struct Aabb { pub minimum: Vec3, pub maximum: Vec3, } impl Index<usize> for Aabb { type Output = Vec3; fn index(&self, i: usize) -> &Vec3 { match i { 0 => &self.minimum, _ => &self.maximum, } } } impl Aabb { pub fn new(minimum: Vec3, maximum: Vec3) -> Self { Aabb { minimum, maximum, } } pub fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> bool { let mut t0 = (self[ray.sign[0]].x - ray.origin.x) * ray.inv_direction.x; let mut t1 = (self[1 - ray.sign[0]].x - ray.origin.x) * ray.inv_direction.x; let ty0 = (self[ray.sign[1]].y - ray.origin.y) * ray.inv_direction.y; let ty1 = (self[1 - ray.sign[1]].y - ray.origin.y) * ray.inv_direction.y; if t0 > ty1 || ty0 > t1 { return false; } if ty0 > t0 { t0 = ty0; } if ty1 < t1 { t1 = ty1; } let tz0 = (self[ray.sign[2]].z - ray.origin.z) * ray.inv_direction.z; let tz1 = (self[1 - ray.sign[2]].z - ray.origin.z) * ray.inv_direction.z; if t0 > tz1 || tz0 > t1 { return false; } if tz0 > t0 { t0 = tz0; } if tz1 < t1 { t1 = tz1; } t0 < t_max && t1 > t_min } pub fn surrounding_box(&self, other: &Aabb) -> Aabb { let small = Vec3::new( self.minimum.x.min(other.minimum.x), self.minimum.y.min(other.minimum.y), self.minimum.z.min(other.minimum.z), ); let big = Vec3::new( self.maximum.x.max(other.maximum.x), self.maximum.y.max(other.maximum.y), self.maximum.z.max(other.maximum.z), ); Aabb::new(small, big) } }
pub mod display; pub mod screen;
#![no_std] extern crate aesni; #[test] fn aes128() { let key = [ 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c, ]; let plaintext = [ [ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, ], [ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, ], [ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, ], [ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10, ], ]; let ciphertext = [ [ 0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60, 0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97, ], [ 0xf5, 0xd3, 0xd5, 0x85, 0x03, 0xb9, 0x69, 0x9d, 0xe7, 0x85, 0x89, 0x5a, 0x96, 0xfd, 0xba, 0xaf, ], [ 0x43, 0xb1, 0xcd, 0x7f, 0x59, 0x8e, 0xce, 0x23, 0x88, 0x1b, 0x00, 0xe3, 0xed, 0x03, 0x06, 0x88, ], [ 0x7b, 0x0c, 0x78, 0x5e, 0x27, 0xe8, 0xad, 0x3f, 0x82, 0x23, 0x20, 0x71, 0x04, 0x72, 0x5d, 0xd4, ], ]; let cipher = aesni::Aes128::init(&key); for (p, c) in plaintext.iter().zip(ciphertext.iter()) { let mut pc = p.clone(); let mut cc = c.clone(); cipher.encrypt(&mut pc); cipher.decrypt(&mut cc); assert_eq!(&pc, c); assert_eq!(&cc, p); } let mut p8 = [0u8; 8*16]; let mut c8 = [0u8; 8*16]; let mut p8c = [0u8; 8*16]; let mut c8c = [0u8; 8*16]; for i in 0..2 { for j in 0..4 { let k = 16*(4*i + j); let k1 = k + 16; p8[k..k1].copy_from_slice(&plaintext[j]); p8c[k..k1].copy_from_slice(&plaintext[j]); c8[k..k1].copy_from_slice(&ciphertext[j]); c8c[k..k1].copy_from_slice(&ciphertext[j]); } } cipher.encrypt8(&mut p8c); cipher.decrypt8(&mut c8c); assert_eq!(&p8c[..], &c8[..]); assert_eq!(&c8c[..], &p8[..]); } #[test] fn aes192() { let key = [ 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b, ]; let plaintext = [ [ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, ], [ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, ], [ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, ], [ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10, ], ]; let ciphertext = [ [ 0xbd, 0x33, 0x4f, 0x1d, 0x6e, 0x45, 0xf2, 0x5f, 0xf7, 0x12, 0xa2, 0x14, 0x57, 0x1f, 0xa5, 0xcc, ], [ 0x97, 0x41, 0x04, 0x84, 0x6d, 0x0a, 0xd3, 0xad, 0x77, 0x34, 0xec, 0xb3, 0xec, 0xee, 0x4e, 0xef, ], [ 0xef, 0x7a, 0xfd, 0x22, 0x70, 0xe2, 0xe6, 0x0a, 0xdc, 0xe0, 0xba, 0x2f, 0xac, 0xe6, 0x44, 0x4e, ], [ 0x9a, 0x4b, 0x41, 0xba, 0x73, 0x8d, 0x6c, 0x72, 0xfb, 0x16, 0x69, 0x16, 0x03, 0xc1, 0x8e, 0x0e, ], ]; let cipher = aesni::Aes192::init(&key); for (p, c) in plaintext.iter().zip(ciphertext.iter()) { let mut pc = p.clone(); let mut cc = c.clone(); cipher.encrypt(&mut pc); cipher.decrypt(&mut cc); assert_eq!(&pc, c); assert_eq!(&cc, p); } let mut p8 = [0u8; 8*16]; let mut c8 = [0u8; 8*16]; let mut p8c = [0u8; 8*16]; let mut c8c = [0u8; 8*16]; for i in 0..2 { for j in 0..4 { let k = 16*(4*i + j); let k1 = k + 16; p8[k..k1].copy_from_slice(&plaintext[j]); p8c[k..k1].copy_from_slice(&plaintext[j]); c8[k..k1].copy_from_slice(&ciphertext[j]); c8c[k..k1].copy_from_slice(&ciphertext[j]); } } cipher.encrypt8(&mut p8c); cipher.decrypt8(&mut c8c); assert_eq!(&p8c[..], &c8[..]); assert_eq!(&c8c[..], &p8[..]); } #[test] fn aes256() { let key = [ 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4, ]; let plaintext = [ [ 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, ], [ 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, ], [ 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, ], [ 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10, ], ]; let ciphertext = [ [ 0xf3, 0xee, 0xd1, 0xbd, 0xb5, 0xd2, 0xa0, 0x3c, 0x06, 0x4b, 0x5a, 0x7e, 0x3d, 0xb1, 0x81, 0xf8, ], [ 0x59, 0x1c, 0xcb, 0x10, 0xd4, 0x10, 0xed, 0x26, 0xdc, 0x5b, 0xa7, 0x4a, 0x31, 0x36, 0x28, 0x70, ], [ 0xb6, 0xed, 0x21, 0xb9, 0x9c, 0xa6, 0xf4, 0xf9, 0xf1, 0x53, 0xe7, 0xb1, 0xbe, 0xaf, 0xed, 0x1d, ], [ 0x23, 0x30, 0x4b, 0x7a, 0x39, 0xf9, 0xf3, 0xff, 0x06, 0x7d, 0x8d, 0x8f, 0x9e, 0x24, 0xec, 0xc7, ], ]; let cipher = aesni::Aes256::init(&key); for (p, c) in plaintext.iter().zip(ciphertext.iter()) { let mut pc = p.clone(); let mut cc = c.clone(); cipher.encrypt(&mut pc); cipher.decrypt(&mut cc); assert_eq!(&pc, c); assert_eq!(&cc, p); } let mut p8 = [0u8; 8*16]; let mut c8 = [0u8; 8*16]; let mut p8c = [0u8; 8*16]; let mut c8c = [0u8; 8*16]; for i in 0..2 { for j in 0..4 { let k = 16*(4*i + j); let k1 = k + 16; p8[k..k1].copy_from_slice(&plaintext[j]); p8c[k..k1].copy_from_slice(&plaintext[j]); c8[k..k1].copy_from_slice(&ciphertext[j]); c8c[k..k1].copy_from_slice(&ciphertext[j]); } } cipher.encrypt8(&mut p8c); cipher.decrypt8(&mut c8c); assert_eq!(&p8c[..], &c8[..]); assert_eq!(&c8c[..], &p8[..]); }
pub struct ParsedSource { pub shader_type: Option<SourceShaderType>, pub namespace: Option<String>, pub glsl_version: Option<String>, pub import_declarations: Vec<String>, /// The full usable "stripped" glsl source code without ssl directives pub source_tree: Vec<SourceToken>, pub exported_functions: Vec<ExportedFunction>, } pub enum SourceToken { TextSource { body: String, }, HiddenSource { body: String, }, } pub struct ExportedFunction { pub signature: String, } pub enum SourceShaderType { Include, Vertex, Fragment, TessEval, }
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} #[repr(transparent)] pub struct AccessCacheOptions(pub u32); impl AccessCacheOptions { pub const None: Self = Self(0u32); pub const DisallowUserInput: Self = Self(1u32); pub const FastLocationsOnly: Self = Self(2u32); pub const UseReadOnlyCachedCopy: Self = Self(4u32); pub const SuppressAccessTimeUpdate: Self = Self(8u32); } impl ::core::marker::Copy for AccessCacheOptions {} impl ::core::clone::Clone for AccessCacheOptions { fn clone(&self) -> Self { *self } } #[repr(C)] pub struct AccessListEntry { pub Token: ::windows_sys::core::HSTRING, pub Metadata: ::windows_sys::core::HSTRING, } impl ::core::marker::Copy for AccessListEntry {} impl ::core::clone::Clone for AccessListEntry { fn clone(&self) -> Self { *self } } pub type AccessListEntryView = *mut ::core::ffi::c_void; pub type IStorageItemAccessList = *mut ::core::ffi::c_void; pub type ItemRemovedEventArgs = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct RecentStorageItemVisibility(pub i32); impl RecentStorageItemVisibility { pub const AppOnly: Self = Self(0i32); pub const AppAndSystem: Self = Self(1i32); } impl ::core::marker::Copy for RecentStorageItemVisibility {} impl ::core::clone::Clone for RecentStorageItemVisibility { fn clone(&self) -> Self { *self } } pub type StorageItemAccessList = *mut ::core::ffi::c_void; pub type StorageItemMostRecentlyUsedList = *mut ::core::ffi::c_void;
use serde::*; //use serde_json::{*}; use std::fs::File; use std::io::Write; #[derive(Debug, Serialize, Deserialize, PartialEq)] struct Property { name: String, value: String, } #[derive(Debug, Serialize, Deserialize, PartialEq)] struct Params { property: Vec<Property>, } pub fn dane_systemu_to_json(cpu: &str, ram: &str, os: &str) { //let mut parametry = Params::from(Params); let procesor = Property { name: String::from("Processor"), value: String::from(cpu) }; let pamiec = Property { name: String::from("Total Memory"), value: String::from(ram) }; let system_op = Property { name: String::from("OS Data"), value: String::from(os) }; let parametry = Params { property: vec!(procesor, pamiec, system_op) }; let serialize_ustawienia = serde_json::to_string(&parametry).unwrap(); let mut plik_json_data_system = File::create("Mods/SevenWebser/scripts/data_system.json").expect("Unable to create file"); plik_json_data_system.write_all(serialize_ustawienia.as_bytes()).expect("Unable to write data"); }
extern crate clap; use clap::{ App, Arg }; fn main() { let matches = App::new("trustlr") .version("0.0.1") .about("Helps bulk download Tumblr blogs") .author("Yalin Gunayer") .arg(Arg::with_name("name") .required(true) .help("The name of the blog to download")) .get_matches(); let blog_name = matches.value_of("name").unwrap(); println!("Will download blog {}", blog_name); }
/* origin: FreeBSD /usr/src/lib/msun/src/s_cbrt.c */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this * software is freely granted, provided that this notice * is preserved. * ==================================================== * * Optimized by Bruce D. Evans. */ /* cbrt(x) * Return cube root of x */ use core::f64; const B1: u32 = 715094163; /* B1 = (1023-1023/3-0.03306235651)*2**20 */ const B2: u32 = 696219795; /* B2 = (1023-1023/3-54/3-0.03306235651)*2**20 */ /* |1/cbrt(x) - p(x)| < 2**-23.5 (~[-7.93e-8, 7.929e-8]). */ const P0: f64 = 1.87595182427177009643; /* 0x3ffe03e6, 0x0f61e692 */ const P1: f64 = -1.88497979543377169875; /* 0xbffe28e0, 0x92f02420 */ const P2: f64 = 1.621429720105354466140; /* 0x3ff9f160, 0x4a49d6c2 */ const P3: f64 = -0.758397934778766047437; /* 0xbfe844cb, 0xbee751d9 */ const P4: f64 = 0.145996192886612446982; /* 0x3fc2b000, 0xd4e4edd7 */ // Cube root (f64) /// /// Computes the cube root of the argument. #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] pub fn cbrt(x: f64) -> f64 { let x1p54 = f64::from_bits(0x4350000000000000); // 0x1p54 === 2 ^ 54 let mut ui: u64 = x.to_bits(); let mut r: f64; let s: f64; let mut t: f64; let w: f64; let mut hx: u32 = (ui >> 32) as u32 & 0x7fffffff; if hx >= 0x7ff00000 { /* cbrt(NaN,INF) is itself */ return x + x; } /* * Rough cbrt to 5 bits: * cbrt(2**e*(1+m) ~= 2**(e/3)*(1+(e%3+m)/3) * where e is integral and >= 0, m is real and in [0, 1), and "/" and * "%" are integer division and modulus with rounding towards minus * infinity. The RHS is always >= the LHS and has a maximum relative * error of about 1 in 16. Adding a bias of -0.03306235651 to the * (e%3+m)/3 term reduces the error to about 1 in 32. With the IEEE * floating point representation, for finite positive normal values, * ordinary integer divison of the value in bits magically gives * almost exactly the RHS of the above provided we first subtract the * exponent bias (1023 for doubles) and later add it back. We do the * subtraction virtually to keep e >= 0 so that ordinary integer * division rounds towards minus infinity; this is also efficient. */ if hx < 0x00100000 { /* zero or subnormal? */ ui = (x * x1p54).to_bits(); hx = (ui >> 32) as u32 & 0x7fffffff; if hx == 0 { return x; /* cbrt(0) is itself */ } hx = hx / 3 + B2; } else { hx = hx / 3 + B1; } ui &= 1 << 63; ui |= (hx as u64) << 32; t = f64::from_bits(ui); /* * New cbrt to 23 bits: * cbrt(x) = t*cbrt(x/t**3) ~= t*P(t**3/x) * where P(r) is a polynomial of degree 4 that approximates 1/cbrt(r) * to within 2**-23.5 when |r - 1| < 1/10. The rough approximation * has produced t such than |t/cbrt(x) - 1| ~< 1/32, and cubing this * gives us bounds for r = t**3/x. * * Try to optimize for parallel evaluation as in __tanf.c. */ r = (t * t) * (t / x); t = t * ((P0 + r * (P1 + r * P2)) + ((r * r) * r) * (P3 + r * P4)); /* * Round t away from zero to 23 bits (sloppily except for ensuring that * the result is larger in magnitude than cbrt(x) but not much more than * 2 23-bit ulps larger). With rounding towards zero, the error bound * would be ~5/6 instead of ~4/6. With a maximum error of 2 23-bit ulps * in the rounded t, the infinite-precision error in the Newton * approximation barely affects third digit in the final error * 0.667; the error in the rounded t can be up to about 3 23-bit ulps * before the final error is larger than 0.667 ulps. */ ui = t.to_bits(); ui = (ui + 0x80000000) & 0xffffffffc0000000; t = f64::from_bits(ui); /* one step Newton iteration to 53 bits with error < 0.667 ulps */ s = t * t; /* t*t is exact */ r = x / s; /* error <= 0.5 ulps; |r| < |t| */ w = t + t; /* t+t is exact */ r = (r - t) / (w + r); /* r-t is exact; w+r ~= 3*t */ t = t + t * r; /* error <= 0.5 + 0.5/3 + epsilon */ t }
use crate::app::AppRoute; use yew::prelude::*; use yew_router::components::RouterAnchor; pub struct UsersManagement {} pub enum Msg {} impl Component for UsersManagement { type Message = Msg; type Properties = (); fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self { UsersManagement {} } fn update(&mut self, _msg: Self::Message) -> ShouldRender { true } fn change(&mut self, _: Self::Properties) -> ShouldRender { false } fn view(&self) -> Html { // type Anchor = RouterAnchor<AppRoute>; html! { <div> <div class="mx-auto pt-5 pb-5 px-4" style="max-width: 1048px;"> <p class="fs-2 fw-bold">{"Users"}</p> </div> </div> } } }
use std::ops::Deref; use std::sync::Arc; use ash::prelude::VkResult; use ash::vk; use crate::raw::RawVkDevice; pub struct RawVkCommandPool { pub pool: vk::CommandPool, pub device: Arc<RawVkDevice>, } impl RawVkCommandPool { pub fn new( device: &Arc<RawVkDevice>, create_info: &vk::CommandPoolCreateInfo, ) -> VkResult<Self> { unsafe { device .create_command_pool(create_info, None) .map(|pool| Self { pool, device: device.clone(), }) } } } impl Deref for RawVkCommandPool { type Target = vk::CommandPool; fn deref(&self) -> &Self::Target { &self.pool } } impl Drop for RawVkCommandPool { fn drop(&mut self) { unsafe { self.device.device.destroy_command_pool(self.pool, None); } } }
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Devices_Lights_Effects")] pub mod Effects; #[repr(transparent)] #[doc(hidden)] pub struct ILamp(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ILamp { type Vtable = ILamp_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x047d5b9a_ea45_4b2b_b1a2_14dff00bde7b); } #[repr(C)] #[doc(hidden)] pub struct ILamp_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 bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut f32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: f32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, handler: ::windows::core::RawPtr, result__: *mut 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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ILampArray(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ILampArray { type Vtable = ILampArray_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7ace9787_c8a0_4e95_a1e0_d58676538649); } #[repr(C)] #[doc(hidden)] pub struct ILampArray_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 u16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut u16) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut LampArrayKind) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation_Numerics")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::Numerics::Vector3) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Numerics"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut f64) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: f64) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lampindex: i32, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "System")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, key: super::super::System::VirtualKey, result_size__: *mut u32, result__: *mut *mut i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "System"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, purposes: LampPurposes, result_size__: *mut u32, result__: *mut *mut i32) -> ::windows::core::HRESULT, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, desiredcolor: super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, lampindex: i32, desiredcolor: super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, desiredcolor: super::super::UI::Color, lampIndexes_array_size: u32, lampindexes: *const i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, desiredColors_array_size: u32, desiredcolors: *const super::super::UI::Color, lampIndexes_array_size: u32, lampindexes: *const i32) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(all(feature = "System", feature = "UI"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, desiredcolor: super::super::UI::Color, key: super::super::System::VirtualKey) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "System", feature = "UI")))] usize, #[cfg(all(feature = "System", feature = "UI"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, desiredColors_array_size: u32, desiredcolors: *const super::super::UI::Color, keys_array_size: u32, keys: *const super::super::System::VirtualKey) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "System", feature = "UI")))] usize, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, desiredcolor: super::super::UI::Color, purposes: LampPurposes) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(all(feature = "Foundation", feature = "Storage_Streams"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, messageid: i32, message: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Storage_Streams")))] usize, #[cfg(all(feature = "Foundation", feature = "Storage_Streams"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, messageid: i32, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Storage_Streams")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ILampArrayStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ILampArrayStatics { type Vtable = ILampArrayStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7bb8c98d_5fc1_452d_bb1f_4ad410d398ff); } #[repr(C)] #[doc(hidden)] pub struct ILampArrayStatics_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, deviceid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ILampAvailabilityChangedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ILampAvailabilityChangedEventArgs { type Vtable = ILampAvailabilityChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4f6e3ded_07a2_499d_9260_67e304532ba4); } #[repr(C)] #[doc(hidden)] pub struct ILampAvailabilityChangedEventArgs_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 bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ILampInfo(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ILampInfo { type Vtable = ILampInfo_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x30bb521c_0acf_49da_8c10_150b9cf62713); } #[repr(C)] #[doc(hidden)] pub struct ILampInfo_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 i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut LampPurposes) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation_Numerics")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::Numerics::Vector3) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Numerics"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut i32) -> ::windows::core::HRESULT, #[cfg(all(feature = "Foundation", feature = "UI"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "UI")))] usize, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, desiredcolor: super::super::UI::Color, result__: *mut super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ILampStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ILampStatics { type Vtable = ILampStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa822416c_8885_401e_b821_8e8b38a8e8ec); } #[repr(C)] #[doc(hidden)] pub struct ILampStatics_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, deviceid: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, 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)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct Lamp(pub ::windows::core::IInspectable); impl Lamp { pub fn DeviceId(&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 IsEnabled(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetIsEnabled(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value).ok() } } pub fn BrightnessLevel(&self) -> ::windows::core::Result<f32> { let this = self; unsafe { let mut result__: f32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<f32>(result__) } } pub fn SetBrightnessLevel(&self, value: f32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value).ok() } } pub fn IsColorSettable(&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 = "UI")] pub fn Color(&self) -> ::windows::core::Result<super::super::UI::Color> { let this = self; unsafe { let mut result__: super::super::UI::Color = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::UI::Color>(result__) } } #[cfg(feature = "UI")] pub fn SetColor<'a, Param0: ::windows::core::IntoParam<'a, super::super::UI::Color>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn AvailabilityChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<Lamp, LampAvailabilityChangedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveAvailabilityChanged<'a, Param0: ::windows::core::IntoParam<'a, 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 Close(&self) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::super::Foundation::IClosable>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this)).ok() } } pub fn GetDeviceSelector() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ILampStatics(|this| 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 FromIdAsync<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(deviceid: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<Lamp>> { Self::ILampStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), deviceid.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<Lamp>>(result__) }) } #[cfg(feature = "Foundation")] pub fn GetDefaultAsync() -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<Lamp>> { Self::ILampStatics(|this| 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::Foundation::IAsyncOperation<Lamp>>(result__) }) } pub fn ILampStatics<R, F: FnOnce(&ILampStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<Lamp, ILampStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for Lamp { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Lights.Lamp;{047d5b9a-ea45-4b2b-b1a2-14dff00bde7b})"); } unsafe impl ::windows::core::Interface for Lamp { type Vtable = ILamp_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x047d5b9a_ea45_4b2b_b1a2_14dff00bde7b); } impl ::windows::core::RuntimeName for Lamp { const NAME: &'static str = "Windows.Devices.Lights.Lamp"; } impl ::core::convert::From<Lamp> for ::windows::core::IUnknown { fn from(value: Lamp) -> Self { value.0 .0 } } impl ::core::convert::From<&Lamp> for ::windows::core::IUnknown { fn from(value: &Lamp) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for Lamp { 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 Lamp { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<Lamp> for ::windows::core::IInspectable { fn from(value: Lamp) -> Self { value.0 } } impl ::core::convert::From<&Lamp> for ::windows::core::IInspectable { fn from(value: &Lamp) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for Lamp { 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 Lamp { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<Lamp> for super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: Lamp) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<&Lamp> for super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: &Lamp) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::IClosable> for Lamp { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::IClosable> { ::windows::core::IntoParam::into_param(&self) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::IClosable> for &Lamp { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::IClosable> { ::core::convert::TryInto::<super::super::Foundation::IClosable>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for Lamp {} unsafe impl ::core::marker::Sync for Lamp {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct LampArray(pub ::windows::core::IInspectable); impl LampArray { pub fn DeviceId(&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 HardwareVendorId(&self) -> ::windows::core::Result<u16> { let this = self; unsafe { let mut result__: u16 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u16>(result__) } } pub fn HardwareProductId(&self) -> ::windows::core::Result<u16> { let this = self; unsafe { let mut result__: u16 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u16>(result__) } } pub fn HardwareVersion(&self) -> ::windows::core::Result<u16> { let this = self; unsafe { let mut result__: u16 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u16>(result__) } } pub fn LampArrayKind(&self) -> ::windows::core::Result<LampArrayKind> { let this = self; unsafe { let mut result__: LampArrayKind = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<LampArrayKind>(result__) } } pub fn LampCount(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } #[cfg(feature = "Foundation")] pub fn MinUpdateInterval(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation_Numerics")] pub fn BoundingBox(&self) -> ::windows::core::Result<super::super::Foundation::Numerics::Vector3> { let this = self; unsafe { let mut result__: super::super::Foundation::Numerics::Vector3 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Numerics::Vector3>(result__) } } pub fn IsEnabled(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetIsEnabled(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value).ok() } } pub fn BrightnessLevel(&self) -> ::windows::core::Result<f64> { let this = self; unsafe { let mut result__: f64 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<f64>(result__) } } pub fn SetBrightnessLevel(&self, value: f64) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), value).ok() } } pub fn IsConnected(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SupportsVirtualKeys(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).19)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn GetLampInfo(&self, lampindex: i32) -> ::windows::core::Result<LampInfo> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).20)(::core::mem::transmute_copy(this), lampindex, &mut result__).from_abi::<LampInfo>(result__) } } #[cfg(feature = "System")] pub fn GetIndicesForKey(&self, key: super::super::System::VirtualKey) -> ::windows::core::Result<::windows::core::Array<i32>> { let this = self; unsafe { let mut result__: ::windows::core::Array<i32> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).21)(::core::mem::transmute_copy(this), key, ::windows::core::Array::<i32>::set_abi_len(&mut result__), &mut result__ as *mut _ as _).and_then(|| result__) } } pub fn GetIndicesForPurposes(&self, purposes: LampPurposes) -> ::windows::core::Result<::windows::core::Array<i32>> { let this = self; unsafe { let mut result__: ::windows::core::Array<i32> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).22)(::core::mem::transmute_copy(this), purposes, ::windows::core::Array::<i32>::set_abi_len(&mut result__), &mut result__ as *mut _ as _).and_then(|| result__) } } #[cfg(feature = "UI")] pub fn SetColor<'a, Param0: ::windows::core::IntoParam<'a, super::super::UI::Color>>(&self, desiredcolor: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).23)(::core::mem::transmute_copy(this), desiredcolor.into_param().abi()).ok() } } #[cfg(feature = "UI")] pub fn SetColorForIndex<'a, Param1: ::windows::core::IntoParam<'a, super::super::UI::Color>>(&self, lampindex: i32, desiredcolor: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).24)(::core::mem::transmute_copy(this), lampindex, desiredcolor.into_param().abi()).ok() } } #[cfg(feature = "UI")] pub fn SetSingleColorForIndices<'a, Param0: ::windows::core::IntoParam<'a, super::super::UI::Color>>(&self, desiredcolor: Param0, lampindexes: &[<i32 as ::windows::core::DefaultType>::DefaultType]) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).25)(::core::mem::transmute_copy(this), desiredcolor.into_param().abi(), lampindexes.len() as u32, ::core::mem::transmute(lampindexes.as_ptr())).ok() } } #[cfg(feature = "UI")] pub fn SetColorsForIndices(&self, desiredcolors: &[<super::super::UI::Color as ::windows::core::DefaultType>::DefaultType], lampindexes: &[<i32 as ::windows::core::DefaultType>::DefaultType]) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).26)(::core::mem::transmute_copy(this), desiredcolors.len() as u32, ::core::mem::transmute(desiredcolors.as_ptr()), lampindexes.len() as u32, ::core::mem::transmute(lampindexes.as_ptr())).ok() } } #[cfg(all(feature = "System", feature = "UI"))] pub fn SetColorsForKey<'a, Param0: ::windows::core::IntoParam<'a, super::super::UI::Color>>(&self, desiredcolor: Param0, key: super::super::System::VirtualKey) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).27)(::core::mem::transmute_copy(this), desiredcolor.into_param().abi(), key).ok() } } #[cfg(all(feature = "System", feature = "UI"))] pub fn SetColorsForKeys(&self, desiredcolors: &[<super::super::UI::Color as ::windows::core::DefaultType>::DefaultType], keys: &[<super::super::System::VirtualKey as ::windows::core::DefaultType>::DefaultType]) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).28)(::core::mem::transmute_copy(this), desiredcolors.len() as u32, ::core::mem::transmute(desiredcolors.as_ptr()), keys.len() as u32, ::core::mem::transmute(keys.as_ptr())).ok() } } #[cfg(feature = "UI")] pub fn SetColorsForPurposes<'a, Param0: ::windows::core::IntoParam<'a, super::super::UI::Color>>(&self, desiredcolor: Param0, purposes: LampPurposes) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).29)(::core::mem::transmute_copy(this), desiredcolor.into_param().abi(), purposes).ok() } } #[cfg(all(feature = "Foundation", feature = "Storage_Streams"))] pub fn SendMessageAsync<'a, Param1: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IBuffer>>(&self, messageid: i32, message: Param1) -> ::windows::core::Result<super::super::Foundation::IAsyncAction> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).30)(::core::mem::transmute_copy(this), messageid, message.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncAction>(result__) } } #[cfg(all(feature = "Foundation", feature = "Storage_Streams"))] pub fn RequestMessageAsync(&self, messageid: i32) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<super::super::Storage::Streams::IBuffer>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).31)(::core::mem::transmute_copy(this), messageid, &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<super::super::Storage::Streams::IBuffer>>(result__) } } pub fn GetDeviceSelector() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ILampArrayStatics(|this| 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 FromIdAsync<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(deviceid: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<LampArray>> { Self::ILampArrayStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), deviceid.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<LampArray>>(result__) }) } pub fn ILampArrayStatics<R, F: FnOnce(&ILampArrayStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<LampArray, ILampArrayStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for LampArray { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Lights.LampArray;{7ace9787-c8a0-4e95-a1e0-d58676538649})"); } unsafe impl ::windows::core::Interface for LampArray { type Vtable = ILampArray_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7ace9787_c8a0_4e95_a1e0_d58676538649); } impl ::windows::core::RuntimeName for LampArray { const NAME: &'static str = "Windows.Devices.Lights.LampArray"; } impl ::core::convert::From<LampArray> for ::windows::core::IUnknown { fn from(value: LampArray) -> Self { value.0 .0 } } impl ::core::convert::From<&LampArray> for ::windows::core::IUnknown { fn from(value: &LampArray) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for LampArray { 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 LampArray { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<LampArray> for ::windows::core::IInspectable { fn from(value: LampArray) -> Self { value.0 } } impl ::core::convert::From<&LampArray> for ::windows::core::IInspectable { fn from(value: &LampArray) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for LampArray { 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 LampArray { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for LampArray {} unsafe impl ::core::marker::Sync for LampArray {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct LampArrayKind(pub i32); impl LampArrayKind { pub const Undefined: LampArrayKind = LampArrayKind(0i32); pub const Keyboard: LampArrayKind = LampArrayKind(1i32); pub const Mouse: LampArrayKind = LampArrayKind(2i32); pub const GameController: LampArrayKind = LampArrayKind(3i32); pub const Peripheral: LampArrayKind = LampArrayKind(4i32); pub const Scene: LampArrayKind = LampArrayKind(5i32); pub const Notification: LampArrayKind = LampArrayKind(6i32); pub const Chassis: LampArrayKind = LampArrayKind(7i32); pub const Wearable: LampArrayKind = LampArrayKind(8i32); pub const Furniture: LampArrayKind = LampArrayKind(9i32); pub const Art: LampArrayKind = LampArrayKind(10i32); } impl ::core::convert::From<i32> for LampArrayKind { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for LampArrayKind { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for LampArrayKind { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.Lights.LampArrayKind;i4)"); } impl ::windows::core::DefaultType for LampArrayKind { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct LampAvailabilityChangedEventArgs(pub ::windows::core::IInspectable); impl LampAvailabilityChangedEventArgs { pub fn IsAvailable(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } } unsafe impl ::windows::core::RuntimeType for LampAvailabilityChangedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Lights.LampAvailabilityChangedEventArgs;{4f6e3ded-07a2-499d-9260-67e304532ba4})"); } unsafe impl ::windows::core::Interface for LampAvailabilityChangedEventArgs { type Vtable = ILampAvailabilityChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4f6e3ded_07a2_499d_9260_67e304532ba4); } impl ::windows::core::RuntimeName for LampAvailabilityChangedEventArgs { const NAME: &'static str = "Windows.Devices.Lights.LampAvailabilityChangedEventArgs"; } impl ::core::convert::From<LampAvailabilityChangedEventArgs> for ::windows::core::IUnknown { fn from(value: LampAvailabilityChangedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&LampAvailabilityChangedEventArgs> for ::windows::core::IUnknown { fn from(value: &LampAvailabilityChangedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for LampAvailabilityChangedEventArgs { 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 LampAvailabilityChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<LampAvailabilityChangedEventArgs> for ::windows::core::IInspectable { fn from(value: LampAvailabilityChangedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&LampAvailabilityChangedEventArgs> for ::windows::core::IInspectable { fn from(value: &LampAvailabilityChangedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for LampAvailabilityChangedEventArgs { 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 LampAvailabilityChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for LampAvailabilityChangedEventArgs {} unsafe impl ::core::marker::Sync for LampAvailabilityChangedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct LampInfo(pub ::windows::core::IInspectable); impl LampInfo { pub fn Index(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } pub fn Purposes(&self) -> ::windows::core::Result<LampPurposes> { let this = self; unsafe { let mut result__: LampPurposes = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<LampPurposes>(result__) } } #[cfg(feature = "Foundation_Numerics")] pub fn Position(&self) -> ::windows::core::Result<super::super::Foundation::Numerics::Vector3> { let this = self; unsafe { let mut result__: super::super::Foundation::Numerics::Vector3 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Numerics::Vector3>(result__) } } pub fn RedLevelCount(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } pub fn GreenLevelCount(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } pub fn BlueLevelCount(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } pub fn GainLevelCount(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } #[cfg(all(feature = "Foundation", feature = "UI"))] pub fn FixedColor(&self) -> ::windows::core::Result<super::super::Foundation::IReference<super::super::UI::Color>> { 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::Foundation::IReference<super::super::UI::Color>>(result__) } } #[cfg(feature = "UI")] pub fn GetNearestSupportedColor<'a, Param0: ::windows::core::IntoParam<'a, super::super::UI::Color>>(&self, desiredcolor: Param0) -> ::windows::core::Result<super::super::UI::Color> { let this = self; unsafe { let mut result__: super::super::UI::Color = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), desiredcolor.into_param().abi(), &mut result__).from_abi::<super::super::UI::Color>(result__) } } #[cfg(feature = "Foundation")] pub fn UpdateLatency(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } } unsafe impl ::windows::core::RuntimeType for LampInfo { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.Lights.LampInfo;{30bb521c-0acf-49da-8c10-150b9cf62713})"); } unsafe impl ::windows::core::Interface for LampInfo { type Vtable = ILampInfo_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x30bb521c_0acf_49da_8c10_150b9cf62713); } impl ::windows::core::RuntimeName for LampInfo { const NAME: &'static str = "Windows.Devices.Lights.LampInfo"; } impl ::core::convert::From<LampInfo> for ::windows::core::IUnknown { fn from(value: LampInfo) -> Self { value.0 .0 } } impl ::core::convert::From<&LampInfo> for ::windows::core::IUnknown { fn from(value: &LampInfo) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for LampInfo { 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 LampInfo { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<LampInfo> for ::windows::core::IInspectable { fn from(value: LampInfo) -> Self { value.0 } } impl ::core::convert::From<&LampInfo> for ::windows::core::IInspectable { fn from(value: &LampInfo) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for LampInfo { 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 LampInfo { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for LampInfo {} unsafe impl ::core::marker::Sync for LampInfo {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct LampPurposes(pub u32); impl LampPurposes { pub const Undefined: LampPurposes = LampPurposes(0u32); pub const Control: LampPurposes = LampPurposes(1u32); pub const Accent: LampPurposes = LampPurposes(2u32); pub const Branding: LampPurposes = LampPurposes(4u32); pub const Status: LampPurposes = LampPurposes(8u32); pub const Illumination: LampPurposes = LampPurposes(16u32); pub const Presentation: LampPurposes = LampPurposes(32u32); } impl ::core::convert::From<u32> for LampPurposes { fn from(value: u32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for LampPurposes { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for LampPurposes { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.Lights.LampPurposes;u4)"); } impl ::windows::core::DefaultType for LampPurposes { type DefaultType = Self; } impl ::core::ops::BitOr for LampPurposes { type Output = Self; fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) } } impl ::core::ops::BitAnd for LampPurposes { type Output = Self; fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) } } impl ::core::ops::BitOrAssign for LampPurposes { fn bitor_assign(&mut self, rhs: Self) { self.0.bitor_assign(rhs.0) } } impl ::core::ops::BitAndAssign for LampPurposes { fn bitand_assign(&mut self, rhs: Self) { self.0.bitand_assign(rhs.0) } } impl ::core::ops::Not for LampPurposes { type Output = Self; fn not(self) -> Self { Self(self.0.not()) } }
use actix_web::{get, post, web, error, App, HttpServer, HttpResponse}; use serde::Deserialize; use mongodb::Client; use bson::doc; #[derive(Debug, Deserialize)] struct CreateStock { name: String, qty: u32, } #[get("/stocks")] async fn find_all_stocks(db: web::Data<Client>) -> HttpResponse { let col = db.database("stocks").collection("data"); let res = col.find(None, None) .and_then(|rs| rs.collect::<mongodb::error::Result<Vec<_>>>()); match res { Ok(r) => HttpResponse::Ok().json(r), Err(e) => { println!("error: {:?}", e); error::ErrorInternalServerError(e).into() }, } } #[get("/stocks/{id}")] async fn find_stock(db: web::Data<Client>, info: web::Path<(String,)>) -> HttpResponse { let col = db.database("stocks").collection("data"); let id = bson::oid::ObjectId::with_string(&info.0) .map_err(|e| { println!("error: {:?}", e); //HttpResponse::BadRequest().finish() error::ErrorBadRequest(e).into() }); let res = id.and_then(|id| col.find_one(Some(doc! {"_id": id}), None) .map_err(|e| { println!("error: {:?}", e); //HttpResponse::InternalServerError().finish() error::ErrorInternalServerError(e).into() }) ); match res { Ok(r) => HttpResponse::Ok().json(r), Err(e) => e, } } #[post("/stocks")] async fn create_stock(db: web::Data<Client>, params: web::Json<CreateStock>) -> HttpResponse { let col = db.database("stocks").collection("data"); let doc = doc! {"name": params.0.name, "value": params.0.qty }; let res = col.insert_one(doc, None); match res { Ok(r) => { println!("{:?}", r.inserted_id); let oid = bson::from_bson::<bson::oid::ObjectId>(r.inserted_id).unwrap(); HttpResponse::Created().json(oid.to_hex()) }, Err(e) => { println!("error: {:?}", e); //HttpResponse::InternalServerError().finish() error::ErrorInternalServerError(e).into() } } } #[actix_rt::main] async fn main() -> std::io::Result<()> { let addr = "127.0.0.1:8080"; let mongo = Client::with_uri_str("mongodb://localhost").unwrap(); HttpServer::new( move || { App::new() .data(mongo.clone()) .service(create_stock) .service(find_stock) .service(find_all_stocks) }).bind(addr)?.run().await }
use std::{fs, fs::File}; use std::io::prelude::*; use serde::{Deserialize, Serialize}; use serde_json::{json, Value}; use num::{BigUint}; use crate::rsa; #[derive(Serialize, Deserialize)] struct PublicKey { n: BigUint, e: BigUint, } #[derive(Serialize, Deserialize)] struct PrivateKey { d: BigUint } #[derive(Serialize, Deserialize)] struct Cipher { msg: Vec<BigUint> } pub fn write_json_to_disk(key: ((BigUint, BigUint), BigUint)) { let pub_key = json!({ "n": (key.0).0, "e": (key.0).1 }); // println!("key n: {:?}", (key.0).0); // println!("json: {}", pub_key.to_string()); _write_json_to_disk(&pub_key, "pub_key.txt").expect("Something went wrong writing the file"); let priv_key = json!({ "d": key.1 }); // println!("key d: {:?}", key.1); // println!("json: {}", priv_key.to_string()); _write_json_to_disk(&priv_key, "priv_key.txt").expect("Something went wrong writing the file"); } fn _write_json_to_disk(key: &Value, path: &str) -> std::io::Result<()> { let mut file = File::create(path)?; file.write_all(key.to_string().as_ref())?; Ok(()) } pub fn read_key_from_disk() -> std::io::Result<((BigUint, BigUint), BigUint)> { let pub_key_str = fs::read_to_string("pub_key.txt")?; let pub_key: PublicKey = serde_json::from_str(&pub_key_str)?; // println!("json: {:?}", pub_key.n); let priv_key_str = fs::read_to_string("priv_key.txt")?; let priv_key: PrivateKey = serde_json::from_str(&priv_key_str)?; // println!("json: {:?}", priv_key.d); Ok(((pub_key.n, pub_key.e), priv_key.d)) } pub fn write_cipher_to_disk(cipher: &Vec<BigUint>, dest_path: &str) { let cipher_json = json!({ "msg": cipher }); _write_json_to_disk(&cipher_json, dest_path) .expect("Something went wrong reading the file"); } pub fn read_cipher_from_disk(src_path: &str) -> std::io::Result<Vec<BigUint>>{ let cipher_str = fs::read_to_string(src_path)?; let cipher: Cipher = serde_json::from_str(&cipher_str)?; Ok(cipher.msg) } pub fn encrypt_file(src_path: &str, dest_path: &str, pub_key: (BigUint, BigUint)) { let msg = fs::read_to_string(src_path) .expect("Something went wrong reading the file"); let encrypted_msg = rsa::encrypt_str(&msg, pub_key); let cipher = json!({ "msg": encrypted_msg }); _write_json_to_disk(&cipher, dest_path).expect("Something went wrong reading the file"); } pub fn decrypt_file(src_path: &str, dest_path: &str, priv_key: BigUint, pub_key: BigUint) -> std::io::Result<()> { let cipher_str = fs::read_to_string(src_path) .expect("Something went wrong reading the file"); let cipher: Cipher = serde_json::from_str(&cipher_str).unwrap(); // TODO: make this work :o println!("cipher message"); for thing in cipher.msg.clone() { println!("{}", thing); } let decrypted_msg = rsa::decrypt_str(&cipher.msg, priv_key, pub_key); let mut dest = File::create(dest_path)?; dest.write_all(decrypted_msg.as_ref())?; Ok(()) }
//============================================================================== // Notes //============================================================================== // mcu::rtc.rs //============================================================================== // Crates and Mods //============================================================================== use core::cell::{Cell, RefCell}; use core::ops::DerefMut; use cortex_m::interrupt::{free, Mutex}; use nrf52832_pac; use nrf52832_pac::interrupt; //============================================================================== // Enums, Structs, and Types //============================================================================== #[allow(dead_code)] pub enum WakeInterval { Interval125MS = 512, Interval250MS = 1024, Interval500MS = 2048, Interval1S = 4096 } //============================================================================== // Variables //============================================================================== static WAKE_INTERVAL: Mutex<Cell<u32>> = Mutex::new(Cell::new(0)); static FRACTION: Mutex<Cell<u32>> = Mutex::new(Cell::new(0)); static SECONDS: Mutex<Cell<u32>> = Mutex::new(Cell::new(0)); static RTC_HANDLE: Mutex<RefCell<Option<nrf52832_pac::RTC0>>> = Mutex::new(RefCell::new(None)); //============================================================================== // Public Functions //============================================================================== #[allow(dead_code)] pub fn init(rtc: nrf52832_pac::RTC0, clock: &nrf52832_pac::CLOCK, interval: WakeInterval) { free(|cs| WAKE_INTERVAL.borrow(cs).set(interval as u32)); // Enable after HANDLE has been initialized so the mutex is not 'None' configure(&rtc, clock); // Pull the RTC0 reference from the peripherals and add to the mutex here free(|cs| RTC_HANDLE.borrow(cs).replace(Some(rtc))); } #[allow(dead_code)] pub fn get_timestamp() -> u32 { free(|cs| SECONDS.borrow(cs).get()) } #[allow(dead_code)] pub fn get_timediff(seconds: u32) -> u32 { let app_seconds = free(|cs| SECONDS.borrow(cs).get()); app_seconds - seconds } #[allow(dead_code)] pub fn get_timestamp_fraction() -> u32 { free(|cs| FRACTION.borrow(cs).get()) } #[allow(dead_code)] pub fn get_timediff_fraction(seconds: u32, fraction: u32) -> u32 { let app_seconds = free(|cs| SECONDS.borrow(cs).get()); let app_fraction = free(|cs| FRACTION.borrow(cs).get()); ((app_seconds * 1000) + app_fraction) - ((seconds * 1000) + fraction) } //============================================================================== // Private Functions //============================================================================== fn configure(rtc: &nrf52832_pac::RTC0, clock: &nrf52832_pac::CLOCK) { nrf52832_pac::NVIC::mask(nrf52832_pac::Interrupt::RTC0); // Enable XTAL for Low Freq Clock Source clock.lfclksrc.write(|w| w.src().xtal()); clock.tasks_lfclkstart.write(|w| unsafe { w.bits(1) }); //TODO: waiting indefinitely here while clock.events_lfclkstarted.read().bits() == 0 {}; //Disable RTC rtc.tasks_stop.write(|w| unsafe { w.bits(1) }); //prescale by 8 : 32768 / 8 = 4096 Hz rtc.prescaler.write(|w| unsafe { w.prescaler().bits(7) }); //define the wake interval rtc.cc[0].write(|w| unsafe { w.bits( free(|cs| WAKE_INTERVAL.borrow(cs).get()) ) }); //connect the interrupt event signal on compare0 match rtc.intenset.write(|w| w.compare0().set_bit()); unsafe { nrf52832_pac::NVIC::unpend(nrf52832_pac::Interrupt::RTC0); nrf52832_pac::NVIC::unmask(nrf52832_pac::Interrupt::RTC0); } //Enable RTC rtc.tasks_start.write(|w| unsafe { w.bits(1) }); free(|cs| SECONDS.borrow(cs).set(0)); free(|cs| FRACTION.borrow(cs).set(0)); } // ============================================================================= // Interrupt Handler //============================================================================== #[interrupt] fn RTC0() { let mut fraction: u32 = free(|cs| FRACTION.borrow(cs).get()); let mut seconds: u32 = free(|cs| SECONDS.borrow(cs).get()); let wake_interval: u32 = free(|cs| WAKE_INTERVAL.borrow(cs).get()); free(|cs| { if let Some(ref mut rtc) = RTC_HANDLE.borrow(cs).borrow_mut().deref_mut() { if rtc.events_compare[0].read().bits() > 0 { fraction += wake_interval; if fraction >= WakeInterval::Interval1S as u32 { seconds += fraction / WakeInterval::Interval1S as u32; fraction = 0; } } rtc.events_compare[0].write(|w| unsafe { w.bits(0) }); rtc.tasks_clear.write(|w| unsafe { w.bits(1) }); } }); free(|cs| FRACTION.borrow(cs).set(fraction)); free(|cs| SECONDS.borrow(cs).set(seconds)); } //============================================================================== // Task Handler //==============================================================================
for ({{>choice.arg_names}}) in trigger_{{call_id}} { #[allow(dead_code)] const DELAYED: bool = {{#if delayed}}true{{else}}false{{/if}}; {{#if make_mut}}let ir_instance = Arc::make_mut(ir_instance);{{/if}} trace!("running trigger file {} line {}", file!(), line!()); let (new_objs, new_actions): (ir::NewObjs, Vec<Action>) = {{code}}?; actions.extend(new_actions); actions.extend(process_lowering(ir_instance, store, &new_objs, diff)?); }
// Max Number of K-Sum Pairs // https://leetcode.com/explore/challenge/card/january-leetcoding-challenge-2021/581/week-3-january-15th-january-21st/3608/ pub struct Solution; impl Solution { pub fn max_operations(nums: Vec<i32>, k: i32) -> i32 { let mut stack = std::collections::HashMap::new(); let mut count = 0; for num in nums { if num >= k { continue; } let complement = k - num; if let Some(c) = stack.get_mut(&complement) { if *c == 1 { stack.remove(&complement); } else { *c -= 1; } count += 1; } else { stack.entry(num).and_modify(|c| *c += 1).or_insert(1); } } count } } #[cfg(test)] mod tests { use super::*; #[test] fn example1() { assert_eq!(Solution::max_operations(vec![1, 2, 3, 4], 5), 2); } #[test] fn example2() { assert_eq!(Solution::max_operations(vec![3, 1, 3, 4, 3], 6), 1); } #[test] fn test1() { assert_eq!( Solution::max_operations(vec![2, 2, 2, 3, 1, 1, 4, 1], 4), 2 ); } #[test] fn test2() { assert_eq!( Solution::max_operations( vec![ 2, 5, 4, 4, 1, 3, 4, 4, 1, 4, 4, 1, 2, 1, 2, 2, 3, 2, 4, 2 ], 3 ), 4 ); } }
use byteorder::{BigEndian, LittleEndian, ReadBytesExt}; #[derive(Debug, From)] pub enum Error { IoError(std::io::Error), InvalidManufacturerId, InvalidVersion, } #[derive(Debug)] pub struct Packet { pub version: u32, pub humidity: f64, pub temperature: f64, pub pressure: f64, pub acceleration_x: f64, pub acceleration_y: f64, pub acceleration_z: f64, pub voltage: f64, } pub fn decode(buf: &mut std::io::Read) -> Result<Packet, Error> { if buf.read_u16::<LittleEndian>()? != 0x0499 { return Err(Error::InvalidManufacturerId); } let version = buf.read_u8()?; match version { 3 => { let humidity = buf.read_u8()?; let temp_int = buf.read_u8()?; let temp_hundredths = buf.read_u8()?; let pressure = buf.read_u16::<BigEndian>()?; let accel_x = buf.read_i16::<BigEndian>()?; let accel_y = buf.read_i16::<BigEndian>()?; let accel_z = buf.read_i16::<BigEndian>()?; let battery_mv = buf.read_u16::<BigEndian>()?; let humidity = humidity as f64 / 2.0; let sign = match temp_int & 0x80 == 0 { true => 1.0, false => -1.0, }; let temperature = sign * ((temp_int & !(0x80)) as f64 + temp_hundredths as f64 / 100.0); let pressure = pressure as f64 + 50000.0; let voltage = battery_mv as f64 / 1000.0; Ok(Packet{ version: 3, humidity: humidity, temperature: temperature, pressure: pressure, acceleration_x: accel_x as f64, acceleration_y: accel_y as f64, acceleration_z: accel_z as f64, voltage: voltage, }) }, _ => Err(Error::InvalidVersion) } }
use std::env; use std::fs; use std::io::Write; use std::path::Path; fn split_spec(input: String) -> (String, String) { let splits: Vec<(&str, &str)> = input .trim() .split("\n") .map(|line| line.split("|").collect()) .map(|line: Vec<&str>| (line[0], line[1])) .collect(); let mut left = String::new(); let mut right = String::new(); for (left_line, right_line) in splits.iter() { left.push_str(left_line.trim()); left.push_str("\\n"); right.push_str(right_line.trim()); right.push_str("\\n"); } (left, right) } fn main() { let paths = fs::read_dir("./spec").unwrap(); let out_dir = env::var("OUT_DIR").unwrap(); let dest_path = Path::new(&out_dir).join("spec_tests.rs"); let mut output_file = fs::File::create(&dest_path).unwrap(); for path in paths { let filepath = path.unwrap().path(); let filename = filepath.file_stem().unwrap().to_str().unwrap(); let contents = fs::read_to_string(filepath.clone()).unwrap(); if contents.contains("\"") { panic!("Input file {} cannot contain double quotes", filename); } let (left, right) = split_spec(contents); output_file .write_all( format!( " #[test] #[wasm_bindgen_test] pub fn spec_{}() {{ self::assert_eq!( parse(\"{}\"), parse(\"{}\"), ); }} ", filename, right, left ) .as_bytes(), ) .unwrap(); } }
pub mod arith_final_tagless; pub use arith_final_tagless::ExprSyn;
use proconio::{input, marker::Usize1}; use topological_sort::topological_sort; fn main() { input! { n: usize, m: usize, xy: [(Usize1, Usize1); m], }; let ord = topological_sort(n, &xy).unwrap(); let mut in_deg = vec![0; n]; for &(_, y) in &xy { in_deg[y] += 1; } if in_deg.iter().filter(|&&d| d == 0).count() >= 2 { println!("No"); return; } let mut to = vec![vec![]; n]; for &(x, y) in &xy { to[x].push(y); } for &u in &ord { let mut next = 0; for &v in &to[u] { assert!(in_deg[v] >= 1); in_deg[v] -= 1; if in_deg[v] == 0 { next += 1; } } if next >= 2 { println!("No"); return; } } println!("Yes"); let mut ans = vec![0; n]; for i in 0..n { ans[ord[i]] = i; } for &(x, y) in &xy { assert!(ans[x] < ans[y]); } for i in 0..n { print!("{}", ans[i] + 1); if i + 1 < n { print!(" "); } else { println!(); } } }
//! Low level Postgres protocol. Defines the encoding and decoding of the messages communicated //! to and from the database server. #![allow(unused)] mod type_format; mod type_id; pub use type_format::TypeFormat; pub use type_id::TypeId; // REQUESTS mod bind; mod describe; mod execute; mod parse; mod password_message; mod query; mod sasl; #[cfg_attr(not(feature = "tls"), allow(unused_imports, dead_code))] mod ssl_request; mod startup_message; mod statement; mod sync; mod terminate; pub(crate) use bind::Bind; pub(crate) use describe::Describe; pub(crate) use execute::Execute; pub(crate) use parse::Parse; pub(crate) use password_message::PasswordMessage; pub(crate) use query::Query; pub(crate) use sasl::{hi, SaslInitialResponse, SaslResponse}; #[cfg_attr(not(feature = "tls"), allow(unused_imports, dead_code))] pub(crate) use ssl_request::SslRequest; pub(crate) use startup_message::StartupMessage; pub(crate) use statement::StatementId; pub(crate) use sync::Sync; pub(crate) use terminate::Terminate; // RESPONSES mod authentication; mod backend_key_data; mod command_complete; mod data_row; mod notification_response; mod parameter_description; mod ready_for_query; mod response; mod row_description; mod message; pub(crate) use authentication::{ Authentication, AuthenticationMd5, AuthenticationSasl, AuthenticationSaslContinue, }; pub(crate) use backend_key_data::BackendKeyData; pub(crate) use command_complete::CommandComplete; pub(crate) use data_row::DataRow; pub(crate) use message::Message; pub(crate) use notification_response::NotificationResponse; pub(crate) use parameter_description::ParameterDescription; pub(crate) use ready_for_query::ReadyForQuery; pub(crate) use response::{Response, Severity}; pub(crate) use row_description::{Field, RowDescription}; pub(crate) trait Write { fn write(&self, buf: &mut Vec<u8>); }
use std::io::{self, Read}; use byteorder::{LittleEndian, BigEndian, ReadBytesExt}; use super::{Value, Tag, Vec2, Vec3, Vec4, Box2, Token, Reader}; pub struct BinaryReader<R> { input: R } fn invalid_token<T>() -> io::Result<T> { Err(io::Error::new(io::ErrorKind::InvalidData, "Invalid token")) } impl<R: Read> BinaryReader<R> { pub fn new(input: R) -> BinaryReader<R> { BinaryReader { input: input } } pub fn into_inner(self) -> R { self.input } fn read_value(&mut self, t: u8) -> io::Result<Value> { match t { 0x00 => self.read_bool().map(Value::Bool), 0x01 => self.read_int().map(Value::Int), 0x02 => self.read_double().map(Value::Double), 0x03 => self.read_vec2().map(Value::Vec2), 0x04 => self.read_vec3().map(Value::Vec3), 0x05 => self.read_vec4().map(Value::Vec4), 0x06 => self.read_box2().map(Value::Box2), 0x07 => self.read_string().map(Value::String), 0x08 => self.read_blob().map(Value::Blob), 0xee => self.read_tag().map(Value::Tag), _ => invalid_token(), } } fn read_array(&mut self, t:u8) -> io::Result<Value> { match t { 0x80 => self.read_array_values(BinaryReader::read_bool) .map(Value::BoolArray), 0x81 => self.read_array_values(BinaryReader::read_int) .map(Value::IntArray), 0x82 => self.read_array_values(BinaryReader::read_double) .map(Value::DoubleArray), 0x83 => self.read_array_values(BinaryReader::read_vec2) .map(Value::Vec2Array), 0x84 => self.read_array_values(BinaryReader::read_vec3) .map(Value::Vec3Array), 0x85 => self.read_array_values(BinaryReader::read_vec4) .map(Value::Vec4Array), 0x86 => self.read_array_values(BinaryReader::read_box2) .map(Value::Box2Array), _ => invalid_token(), } } fn read_tag(&mut self) -> io::Result<Tag> { self.input.read_u32::<BigEndian>() } fn read_bool(&mut self) -> io::Result<bool> { let mut buffer = [0; 1]; try!(self.input.read_exact(&mut buffer)); Ok(buffer[0] != 0) } fn read_uint(&mut self) -> io::Result<u64> { let mut buffer = [0; 1]; let mut length = 0; let mut result = 0u64; loop { if length > 10 { return invalid_token(); } try!(self.input.read_exact(&mut buffer)); result |= (u64::from(buffer[0]) & 0x7f) << (length * 7); length += 1; if buffer[0] & 0x80 == 0 { break; } } Ok(result) } fn read_sint(&mut self) -> io::Result<i64> { let uvalue = try!(self.read_uint()); Ok(if uvalue & 1 != 0 { !(uvalue >> 1) } else { uvalue >> 1 } as i64) } fn read_int(&mut self) -> io::Result<i32> { let value = try!(self.read_sint()); if value > i32::max_value() as i64 || value < i32::min_value() as i64 { return invalid_token() } Ok(value as i32) } fn read_double(&mut self) -> io::Result<f64> { self.input.read_f64::<LittleEndian>() } fn read_vec2(&mut self) -> io::Result<Vec2> { let x = try!(self.read_double()); let y = try!(self.read_double()); Ok((x, y)) } fn read_vec3(&mut self) -> io::Result<Vec3> { let x = try!(self.read_double()); let y = try!(self.read_double()); let z = try!(self.read_double()); Ok((x, y, z)) } fn read_vec4(&mut self) -> io::Result<Vec4> { let x = try!(self.read_double()); let y = try!(self.read_double()); let z = try!(self.read_double()); let w = try!(self.read_double()); Ok((x, y, z, w)) } fn read_box2(&mut self) -> io::Result<Box2> { let min = try!(self.read_vec2()); let max = try!(self.read_vec2()); Ok((min, max)) } fn read_string(&mut self) -> io::Result<Box<str>> { let length = try!(self.read_uint()) as usize; let mut buffer = vec![0; length]; try!(self.input.read_exact(&mut buffer[..])); String::from_utf8(buffer) .map(|s| s.into_boxed_str()) .map_err(|e| io::Error::new(io::ErrorKind::Other, e)) } fn read_blob(&mut self) -> io::Result<Box<[u8]>> { let length = try!(self.read_uint()) as usize; let mut buffer = vec![0; length]; try!(self.input.read_exact(&mut buffer[..])); Ok(buffer.into_boxed_slice()) } fn read_array_values<F, T>(&mut self, f: F) -> io::Result<Box<[T]>> where F: Fn(&mut Self) -> io::Result<T> { let length = try!(self.read_uint()) as usize; let mut result = Vec::with_capacity(length); for _ in 0..length { let v = try!(f(self)); result.push(v); } Ok(result.into_boxed_slice()) } } impl<R: Read> Reader for BinaryReader<R> { fn read_next(&mut self) -> io::Result<Token> { let mut buffer = [0; 1]; let read = try!(self.input.read(&mut buffer)); if read == 0 { return Ok(Token::EndOfFile); } match buffer[0] { 0xfe => Ok(Token::Start), 0xef => Ok(Token::End), 0x00 ... 0x08 | 0xee => self.read_value(buffer[0]).map(Token::Value), 0x80 ... 0x86 => self.read_array(buffer[0]).map(Token::Value), _ => invalid_token(), } } } #[cfg(test)] mod tests { use super::*; use super::super::{Value, Token, Reader}; use std::io::{self, Cursor}; fn setup(data: Vec<u8>) -> BinaryReader<Cursor<Vec<u8>>> { BinaryReader::new(Cursor::new(data)) } fn is_token(result: io::Result<Token>, expected: Token) -> bool { if let Ok(result) = result { result == expected } else { false } } fn is_value(result: io::Result<Token>, expected: Value) -> bool { is_token(result, Token::Value(expected)) } fn is_string(result: io::Result<Token>, expected: &str) -> bool { let s = expected.to_string().into_boxed_str(); is_value(result, Value::String(s)) } fn is_blob(result: io::Result<Token>, expected: Vec<u8>) -> bool { let b = expected.into_boxed_slice(); is_value(result, Value::Blob(b)) } #[test] fn read_simple() { let mut reader = setup(vec![ 0xfe, 0xef ]); assert!(is_token(reader.read_next(), Token::Start)); assert!(is_token(reader.read_next(), Token::End)); assert!(is_token(reader.read_next(), Token::EndOfFile)); } #[test] fn read_simple_values() { let mut reader = setup(vec![ 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01, 0x0c, 0x01, 0x80, 0x02, 0x01, 0xd0, 0x0f, 0x01, 0xf3, 0xed, 0x25, 0x02, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x50, 0x8d, 0x97, 0x6e, 0xba, 0x20, 0xc1, 0xc0, 0x05, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x50, 0x8d, 0x97, 0x6e, 0xba, 0x20, 0xc1, 0xc0, 0xae, 0x47, 0xe1, 0x7a, 0x14, 0x6a, 0x9d, 0xc0, 0x06, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x50, 0x8d, 0x97, 0x6e, 0xba, 0x20, 0xc1, 0xc0, 0xae, 0x47, 0xe1, 0x7a, 0x14, 0x6a, 0x9d, 0xc0, 0xee, 0x53, 0x48, 0x41, 0x50, ]); assert!(is_value(reader.read_next(), Value::Bool(false))); assert!(is_value(reader.read_next(), Value::Bool(true))); assert!(is_value(reader.read_next(), Value::Int(0))); assert!(is_value(reader.read_next(), Value::Int(6))); assert!(is_value(reader.read_next(), Value::Int(128))); assert!(is_value(reader.read_next(), Value::Int(1000))); assert!(is_value(reader.read_next(), Value::Int(-310138))); assert!(is_value(reader.read_next(), Value::Double(67245.375))); assert!(is_value(reader.read_next(), Value::Vec2((67245.375, 3464.85)))); assert!(is_value(reader.read_next(), Value::Vec3((67245.375, 3464.85, -8769.4565)))); assert!(is_value(reader.read_next(), Value::Vec4((67245.375, 3464.85, -8769.4565, -1882.52)))); assert!(is_value(reader.read_next(), Value::Box2(((67245.375, 3464.85), (-8769.4565, -1882.52))))); assert!(is_value(reader.read_next(), Value::Tag(tag!(S H A P)))); assert!(is_token(reader.read_next(), Token::EndOfFile)); } #[test] fn read_string() { let mut reader = setup(vec![ 0x07, 0x00, 0x07, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x07, 0x07, 0x48, 0xc3, 0xa9, 0x6c, 0x6c, 0xc3, 0xb8, 0x07, 0x93, 0x01, 0x4c, 0x6f, 0x72, 0x65, 0x6d, 0x20, 0x69, 0x70, 0x73, 0x75, 0x6d, 0x20, 0x64, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x73, 0x69, 0x74, 0x20, 0x61, 0x6d, 0x65, 0x74, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x63, 0x74, 0x65, 0x74, 0x75, 0x72, 0x20, 0x61, 0x64, 0x69, 0x70, 0x69, 0x73, 0x63, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x6c, 0x69, 0x74, 0x2c, 0x20, 0x73, 0x65, 0x64, 0x20, 0x64, 0x6f, 0x20, 0x65, 0x69, 0x75, 0x73, 0x6d, 0x6f, 0x64, 0x20, 0x74, 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x20, 0x69, 0x6e, 0x63, 0x69, 0x64, 0x69, 0x64, 0x75, 0x6e, 0x74, 0x20, 0x75, 0x74, 0x20, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x65, 0x20, 0x65, 0x74, 0x20, 0x64, 0x6f, 0x6c, 0x6f, 0x72, 0x65, 0x20, 0x6d, 0x61, 0x67, 0x6e, 0x61, 0x20, 0x61, 0x6c, 0x69, 0x71, 0x75, 0x61, 0x2e, 0x20, 0x55, 0x74, 0x20, 0x65, 0x6e, 0x69, 0x6d, 0x20, 0x61, 0x64, 0x20, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x20, 0x76, 0x65, 0x6e, 0x69, 0x61, 0x6d, ]); assert!(is_string(reader.read_next(), "")); assert!(is_string(reader.read_next(), "Hello")); assert!(is_string(reader.read_next(), "Héllø")); assert!(is_string(reader.read_next(), "Lorem ipsum dolor sit amet, consectetur adipiscing elit, \ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \ Ut enim ad minim veniam")); assert!(is_token(reader.read_next(), Token::EndOfFile)); } #[test] fn read_blob() { let mut reader = setup(vec![ 0x08, 0x00, 0x08, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x08, 0x07, 0x48, 0xc3, 0xa9, 0x6c, 0x6c, 0xc3, 0xb8, 0x08, 0x93, 0x01, 0x4c, 0x6f, 0x72, 0x65, 0x6d, 0x20, 0x69, 0x70, 0x73, 0x75, 0x6d, 0x20, 0x64, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x73, 0x69, 0x74, 0x20, 0x61, 0x6d, 0x65, 0x74, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x63, 0x74, 0x65, 0x74, 0x75, 0x72, 0x20, 0x61, 0x64, 0x69, 0x70, 0x69, 0x73, 0x63, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x6c, 0x69, 0x74, 0x2c, 0x20, 0x73, 0x65, 0x64, 0x20, 0x64, 0x6f, 0x20, 0x65, 0x69, 0x75, 0x73, 0x6d, 0x6f, 0x64, 0x20, 0x74, 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x20, 0x69, 0x6e, 0x63, 0x69, 0x64, 0x69, 0x64, 0x75, 0x6e, 0x74, 0x20, 0x75, 0x74, 0x20, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x65, 0x20, 0x65, 0x74, 0x20, 0x64, 0x6f, 0x6c, 0x6f, 0x72, 0x65, 0x20, 0x6d, 0x61, 0x67, 0x6e, 0x61, 0x20, 0x61, 0x6c, 0x69, 0x71, 0x75, 0x61, 0x2e, 0x20, 0x55, 0x74, 0x20, 0x65, 0x6e, 0x69, 0x6d, 0x20, 0x61, 0x64, 0x20, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x20, 0x76, 0x65, 0x6e, 0x69, 0x61, 0x6d, ]); assert!(is_blob(reader.read_next(), vec![])); assert!(is_blob(reader.read_next(), vec![0x48, 0x65, 0x6c, 0x6c, 0x6f])); assert!(is_blob(reader.read_next(), vec![0x48, 0xc3, 0xa9, 0x6c, 0x6c, 0xc3, 0xb8])); assert!(is_blob(reader.read_next(), vec![ 0x4c, 0x6f, 0x72, 0x65, 0x6d, 0x20, 0x69, 0x70, 0x73, 0x75, 0x6d, 0x20, 0x64, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x73, 0x69, 0x74, 0x20, 0x61, 0x6d, 0x65, 0x74, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x65, 0x63, 0x74, 0x65, 0x74, 0x75, 0x72, 0x20, 0x61, 0x64, 0x69, 0x70, 0x69, 0x73, 0x63, 0x69, 0x6e, 0x67, 0x20, 0x65, 0x6c, 0x69, 0x74, 0x2c, 0x20, 0x73, 0x65, 0x64, 0x20, 0x64, 0x6f, 0x20, 0x65, 0x69, 0x75, 0x73, 0x6d, 0x6f, 0x64, 0x20, 0x74, 0x65, 0x6d, 0x70, 0x6f, 0x72, 0x20, 0x69, 0x6e, 0x63, 0x69, 0x64, 0x69, 0x64, 0x75, 0x6e, 0x74, 0x20, 0x75, 0x74, 0x20, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x65, 0x20, 0x65, 0x74, 0x20, 0x64, 0x6f, 0x6c, 0x6f, 0x72, 0x65, 0x20, 0x6d, 0x61, 0x67, 0x6e, 0x61, 0x20, 0x61, 0x6c, 0x69, 0x71, 0x75, 0x61, 0x2e, 0x20, 0x55, 0x74, 0x20, 0x65, 0x6e, 0x69, 0x6d, 0x20, 0x61, 0x64, 0x20, 0x6d, 0x69, 0x6e, 0x69, 0x6d, 0x20, 0x76, 0x65, 0x6e, 0x69, 0x61, 0x6d, ])); assert!(is_token(reader.read_next(), Token::EndOfFile)); } #[test] fn read_arrays() { let mut reader = setup(vec![ 0x80, 0x00, 0x80, 0x03, 0x01, 0x00, 0x01, 0x81, 0x00, 0x81, 0x03, 0x0c, 0x80, 0x02, 0xd0, 0x0f, 0x82, 0x00, 0x82, 0x03, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x50, 0x8d, 0x97, 0x6e, 0xba, 0x20, 0xc1, 0xc0, 0x83, 0x00, 0x83, 0x02, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x50, 0x8d, 0x97, 0x6e, 0xba, 0x20, 0xc1, 0xc0, 0xae, 0x47, 0xe1, 0x7a, 0x14, 0x6a, 0x9d, 0xc0, 0x84, 0x00, 0x84, 0x02, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x50, 0x8d, 0x97, 0x6e, 0xba, 0x20, 0xc1, 0xc0, 0xae, 0x47, 0xe1, 0x7a, 0x14, 0x6a, 0x9d, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x85, 0x00, 0x85, 0x02, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x50, 0x8d, 0x97, 0x6e, 0xba, 0x20, 0xc1, 0xc0, 0xae, 0x47, 0xe1, 0x7a, 0x14, 0x6a, 0x9d, 0xc0, 0xae, 0x47, 0xe1, 0x7a, 0x14, 0x6a, 0x9d, 0xc0, 0x50, 0x8d, 0x97, 0x6e, 0xba, 0x20, 0xc1, 0xc0, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x86, 0x00, 0x86, 0x02, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x50, 0x8d, 0x97, 0x6e, 0xba, 0x20, 0xc1, 0xc0, 0xae, 0x47, 0xe1, 0x7a, 0x14, 0x6a, 0x9d, 0xc0, 0xae, 0x47, 0xe1, 0x7a, 0x14, 0x6a, 0x9d, 0xc0, 0x50, 0x8d, 0x97, 0x6e, 0xba, 0x20, 0xc1, 0xc0, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, ]); assert!(is_value(reader.read_next(), Value::BoolArray(vec![].into_boxed_slice()))); assert!(is_value(reader.read_next(), Value::BoolArray(vec![ true, false, true ].into_boxed_slice()))); assert!(is_value(reader.read_next(), Value::IntArray(vec![].into_boxed_slice()))); assert!(is_value(reader.read_next(), Value::IntArray(vec![ 6, 128, 1000 ].into_boxed_slice()))); assert!(is_value(reader.read_next(), Value::DoubleArray(vec![].into_boxed_slice()))); assert!(is_value(reader.read_next(), Value::DoubleArray(vec![ 67245.375, 3464.85, -8769.4565 ].into_boxed_slice()))); assert!(is_value(reader.read_next(), Value::Vec2Array(vec![].into_boxed_slice()))); assert!(is_value(reader.read_next(), Value::Vec2Array(vec![ (67245.375, 3464.85), (-8769.4565, -1882.52) ].into_boxed_slice()))); assert!(is_value(reader.read_next(), Value::Vec3Array(vec![].into_boxed_slice()))); assert!(is_value(reader.read_next(), Value::Vec3Array(vec![ (67245.375, 3464.85, -8769.4565), (-1882.52, 67245.375, 3464.85), ].into_boxed_slice()))); assert!(is_value(reader.read_next(), Value::Vec4Array(vec![].into_boxed_slice()))); assert!(is_value(reader.read_next(), Value::Vec4Array(vec![ (67245.375, 3464.85, -8769.4565, -1882.52), (-1882.52, -8769.4565, 3464.85, 67245.375), ].into_boxed_slice()))); assert!(is_value(reader.read_next(), Value::Box2Array(vec![].into_boxed_slice()))); assert!(is_value(reader.read_next(), Value::Box2Array(vec![ ((67245.375, 3464.85), (-8769.4565, -1882.52)), ((-1882.52, -8769.4565), (3464.85, 67245.375)), ].into_boxed_slice()))); assert!(is_token(reader.read_next(), Token::EndOfFile)); } #[test] fn skip_to_end() { let mut reader = setup(vec![]); reader.skip_to_end().unwrap(); assert!(is_token(reader.read_next(), Token::EndOfFile)); let mut reader = setup(vec![0xfe, 0xef]); reader.skip_to_end().unwrap(); assert!(is_token(reader.read_next(), Token::EndOfFile)); let mut reader = setup(vec![0xef, 0xef]); reader.skip_to_end().unwrap(); assert!(is_token(reader.read_next(), Token::End)); assert!(is_token(reader.read_next(), Token::EndOfFile)); let mut reader = setup(vec![0xfe, 0xef, 0xef]); reader.skip_to_end().unwrap(); assert!(is_token(reader.read_next(), Token::EndOfFile)); let mut reader = setup(vec![0xfe, 0xef, 0xef, 0xef]); reader.skip_to_end().unwrap(); assert!(is_token(reader.read_next(), Token::End)); assert!(is_token(reader.read_next(), Token::EndOfFile)); let mut reader = setup(vec![0xfe]); assert!(reader.skip_to_end().is_err()); let mut reader = setup(vec![ 0x00, 0x01, 0x01, 0xf3, 0xed, 0x25, 0x03, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0xee, 0x53, 0x48, 0x41, 0x50, 0x07, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x08, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x81, 0x03, 0x0c, 0x80, 0x02, 0xd0, 0x0f, 0xef, 0xef ]); reader.skip_to_end().unwrap(); assert!(is_token(reader.read_next(), Token::End)); assert!(is_token(reader.read_next(), Token::EndOfFile)); } #[test] fn expect_start() { let mut reader = setup(vec![0xfe]); assert!(reader.expect_start().is_ok()); let mut reader = setup(vec![0xef]); assert!(reader.expect_start().is_err()); let mut reader = setup(vec![0x01, 0x01]); assert!(reader.expect_start().is_err()); } #[test] fn expect_start_or_end() { let mut reader = setup(vec![0xfe]); assert_eq!(reader.expect_start_or_end().unwrap(), true); let mut reader = setup(vec![0xef]); assert_eq!(reader.expect_start_or_end().unwrap(), false); let mut reader = setup(vec![]); assert_eq!(reader.expect_start_or_end().unwrap(), false); let mut reader = setup(vec![0x01, 0x01]); assert!(reader.expect_start_or_end().is_err()); } #[test] fn expect_simple_values() { let mut reader = setup(vec![ 0x00, 0x01, 0x01, 0xd0, 0x0f, 0x02, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x50, 0x8d, 0x97, 0x6e, 0xba, 0x20, 0xc1, 0xc0, 0x05, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x50, 0x8d, 0x97, 0x6e, 0xba, 0x20, 0xc1, 0xc0, 0xae, 0x47, 0xe1, 0x7a, 0x14, 0x6a, 0x9d, 0xc0, 0x06, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0xf0, 0x40, 0x33, 0x33, 0x33, 0x33, 0xb3, 0x11, 0xab, 0x40, 0x50, 0x8d, 0x97, 0x6e, 0xba, 0x20, 0xc1, 0xc0, 0xae, 0x47, 0xe1, 0x7a, 0x14, 0x6a, 0x9d, 0xc0, 0xee, 0x53, 0x48, 0x41, 0x50, ]); assert_eq!(reader.expect_bool().unwrap(), true); assert_eq!(reader.expect_int().unwrap(), 1000); assert_eq!(reader.expect_double().unwrap(), 67245.375); assert_eq!(reader.expect_vec2().unwrap(), (67245.375, 3464.85)); assert_eq!(reader.expect_vec3().unwrap(), (67245.375, 3464.85, -8769.4565)); assert_eq!(reader.expect_vec4().unwrap(), (67245.375, 3464.85, -8769.4565, -1882.52)); assert_eq!(reader.expect_box2().unwrap(), ((67245.375, 3464.85), (-8769.4565, -1882.52))); assert_eq!(reader.expect_tag().unwrap(), tag!(S H A P)); } #[test] fn expect_simple_values_fail() { assert!(setup(vec![0xfe]).expect_bool().is_err()); assert!(setup(vec![0xfe]).expect_int().is_err()); assert!(setup(vec![0xfe]).expect_double().is_err()); assert!(setup(vec![0xfe]).expect_vec2().is_err()); assert!(setup(vec![0xfe]).expect_vec3().is_err()); assert!(setup(vec![0xfe]).expect_vec4().is_err()); assert!(setup(vec![0xfe]).expect_box2().is_err()); assert!(setup(vec![0xfe]).expect_tag().is_err()); } #[test] fn expect_arrays() { let mut reader = setup(vec![ 0x80, 0x00, 0x81, 0x00, 0x82, 0x00, 0x83, 0x00, 0x84, 0x00, 0x85, 0x00, 0x86, 0x00, ]); assert_eq!(reader.expect_bool_array().unwrap(), vec![].into_boxed_slice()); assert_eq!(reader.expect_int_array().unwrap(), vec![].into_boxed_slice()); assert_eq!(reader.expect_double_array().unwrap(), vec![].into_boxed_slice()); assert_eq!(reader.expect_vec2_array().unwrap(), vec![].into_boxed_slice()); assert_eq!(reader.expect_vec3_array().unwrap(), vec![].into_boxed_slice()); assert_eq!(reader.expect_vec4_array().unwrap(), vec![].into_boxed_slice()); assert_eq!(reader.expect_box2_array().unwrap(), vec![].into_boxed_slice()); } #[test] fn expect_arrays_fail() { assert!(setup(vec![0xfe]).expect_bool_array().is_err()); assert!(setup(vec![0xfe]).expect_int_array().is_err()); assert!(setup(vec![0xfe]).expect_double_array().is_err()); assert!(setup(vec![0xfe]).expect_vec2_array().is_err()); assert!(setup(vec![0xfe]).expect_vec3_array().is_err()); assert!(setup(vec![0xfe]).expect_vec4_array().is_err()); assert!(setup(vec![0xfe]).expect_box2_array().is_err()); } #[test] fn expect_string() { let mut reader = setup(vec![ 0x07, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0xfe ]); assert_eq!(reader.expect_string().unwrap(), "Hello".to_string().into_boxed_str()); assert!(reader.expect_string().is_err()); } #[test] fn expect_blob() { let mut reader = setup(vec![ 0x08, 0x05, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0xfe ]); assert_eq!(reader.expect_blob().unwrap(), vec![0x48, 0x65, 0x6c, 0x6c, 0x6f].into_boxed_slice()); assert!(reader.expect_blob().is_err()); } }
#![cfg_attr(not(feature = "std"), no_std)] /// Module to manage the impact actions on BitGreen Blockchain use frame_support::{decl_module, decl_storage, decl_event, decl_error, dispatch, ensure, traits::Currency}; use frame_system::{ensure_root,ensure_signed}; use sp_std::prelude::*; use core::str; use core::str::FromStr; #[cfg(test)] mod mock; #[cfg(test)] mod tests; /// Module configuration pub trait Config: frame_system::Config { //pub trait Config: frame_system::Config + Sized { type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>; type Currency: Currency<Self::AccountId>; } pub type Balance = u128; // The runtime storage items decl_storage! { trait Store for Module<T: Config> as impactactions { // we use a safe crypto hashing with blake2_128 // We store the impact actions configuration ImpactActions get(fn get_impactaction): map hasher(blake2_128_concat) u32 => Option<Vec<u8>>; // Categories for impact actions Categories get(fn get_category): map hasher(blake2_128_concat) u32 => Option<Vec<u8>>; // Auditor Configuration Auditors get(fn get_auditor): map hasher(blake2_128_concat) T::AccountId => Option<Vec<u8>>; // Auditor Configuration Oracles get(fn get_oracle): map hasher(blake2_128_concat) u32 => Option<Vec<u8>>; // Impact Action Submission ApprovalRequests get(fn get_approval_request): map hasher(blake2_128_concat) u32 => Option<Vec<u8>>; //Assigned Auditors ApprovalRequestsAuditors get(fn get_auditor_assigned): double_map hasher(blake2_128_concat) u32, hasher(blake2_128_concat) T::AccountId => Option<u32>; //Approval/Refusal of the submissions ApprovalRequestsVotes get(fn get_approval_vote): double_map hasher(blake2_128_concat) u32, hasher(blake2_128_concat)T::AccountId => Option<Vec<u8>>; // Proxy Account for assigning auditors Proxy get(fn get_proxy_account): map hasher(blake2_128_concat) u32 => Option<T::AccountId>; } } // We generate events to inform the users of succesfully actions. decl_event!( pub enum Event<T> where AccountId = <T as frame_system::Config>::AccountId { ImpactActionCreated(u32,Vec<u8>), // New Impact Action configuration has been created ImpactActionDestroyed(u32), // Impact action configuration has been removed ImpactActionProxyCreated(u32), // Proxy account created ImpactActionProxyDestroyed(u32), // Proxy account removed ImpactActionRequestApproval(AccountId,u32), // Impact action approval request ImpactActionCategoryCreated(u32,Vec<u8>), // A new category has been created ImpactActionCategoryDestroyed(u32), // A category has been removed ImpactActionAuditorCreated(AccountId,Vec<u8>), // A new auditor has been created ImpactActionAuditorDestroyed(AccountId), // An auditor has been removed ImpactActionOracleCreated(u32,Vec<u8>), // A new oracle has been added ImpactActionOracleDestroyed(u32), // An oracle has been removed ImpactActionAuditorAssigned(u32,AccountId,u32), // Assigned auditor to a request approval with xx max days to complete the auditing ImpactActionRequestApprovalVoted(AccountId,u32,Vec<u8>), //Vote expressed from an auditor AssignedAuditorDestroyed(u32,AccountId), //Assigned auditor has been revoked } ); // Errors to inform users that something went wrong. decl_error! { pub enum Error for Module<T: Config> { /// Uid cannot be zero UidCannotBeZero, /// The impact action is already on chain (the same uid) DuplicatedImpactAction, /// Wrong configuration lenght, it must be > 12 bytes TooShortConfigurationLength, /// Wrong configuration lenght, it must be <=8192 TooLongConfigurationLength, /// Too short description for the impact action, it must be > 4. TooShortDescription, /// Too short description for the impact action, it must be <=1024. TooLongDescription, /// Too short categories for the impact action, it must be >=3. TooShortCategories, /// Too short categories for the impact action, it must be <=256. TooLongCategories, /// Invalid start block number, it must be >0 InvalidBlockStart, /// Invalid end block number, it must be >0 InvalidBlockEnd, /// Invalid rewards token, it must >=0 InvalidRewardsToken, /// Invalid rewards amount, it must be >0 InvalidRewardsAmount, /// Invalid rewards Oracle, it must be >=0 InvalidRewardsOracle, /// Invalid rewards Auditors, it must be >=0 InvalidRewardsAuditors, /// Invalid slashing amount for Auditors, it must be >=0 InvalidSlashingAuditors, /// Invalid number of maximum errors for an auditor to be revoked InvalidMaxErrorsAuditor, /// Invalid Json received, check the sintax InvalidJson, /// Impact action not found ImpactActionNotFound, /// Category description is too short TooShortCategoryDescription, /// Category description is too long TooLongCategoryDescription, /// Category of the impact action is already present with the same id DuplicatedCategoryImpactAction, /// Category of impact action has not been found CategoryImpactActionNotFound, /// area field is too short TooShortArea, /// area field is too long TooLongArea, /// Minimum Stakes must be >=0 InvalidStakesMinimum, /// Other info is too long, it must be < 1024 TooLongOtherInfo, /// Too short info field TooShortInfo, /// Too long info field TooLongInfo, /// Approval already present for the same id ImpactActionSubmissionDuplicated, /// The auditor id cannot be found AuditorImpactActionNotFound, /// Oracle account is not valid it should be long 48 bytes OracleAccountNotValid, /// Other info missing OtherInfoMissing, /// Oracle Impact action found OracleImpactActionNotFound, /// Proxy id is already present, remove it before to create again. DuplicatedProxyId, /// Proxy account not found ProxyAccountNotFound, /// Impact Action Submission has not been found ImpactActionSubmissionNotFound, /// Auditor cannot be equal to zero AuditorCannotBeZero, /// Max days for auditing cannot be equal to zero MaxDaysCannotBeZero, /// The auditor account is already present, it cannot be duplicated DuplicatedImpactActionAuditor, /// The signer is not assigned as auditor to this impact action SignerNotAssigneAsAuditor, /// Vote is not valid, should be Y or N VoteIsInvalid, /// Other info is too short it must be > 2 bytes OtherInfoTooShort, /// Other info is too long it must be < 1024 bytes OtherInfoTooLong, /// The signing account is not a valid proxy for the operation required. SigningAccountNotValidProxy, /// Number of auditors must be > 0 NumberofAuditorsCannotBeZero, /// Category cannot be zero CategoryCannotBeZero, /// Category has not been found CategoryNotFound, /// Field name is too short, it must be > 0 FieldNameTooShort, /// Field type is wrong, it can be N=Numbers or S=String FieldTypeIsWrong, /// The mandatory flag can be Y or N only FieldMandatoryFlagIsWrong, /// A mandatory custom field has not been submitted MissingMandatoryCustomField, /// Custom field configured as numeric, is not numeric CustomFieldNotNumeric, /// The proxy account is not configured ProxyAccountNotConfigured, /// Vote is already present on chain VoteAlreadyPresent, /// The impact action is not valid because the current block is out of the block frame defined ImpactActionNotValid, /// Assigne Auditor not found for such approval request id AssignedAuditorNotFound, } } // Dispatchable functions allows users to interact with the pallet and invoke state changes. decl_module! { pub struct Module<T: Config> for enum Call where origin: T::Origin { // Errors must be initialized type Error = Error<T>; // Events must be initialized fn deposit_event() = default; /// Create a new impact action configuration #[weight = 1000] pub fn create_impact_action(origin, uid: u32, configuration: Vec<u8>) -> dispatch::DispatchResult { // check the request is signed from Super User let _sender = ensure_root(origin)?; //check configuration length ensure!(configuration.len() > 12, Error::<T>::TooShortConfigurationLength); ensure!(configuration.len() < 8192, Error::<T>::TooLongConfigurationLength); // check the id is > 0 ensure!(uid > 0, Error::<T>::UidCannotBeZero); // check that the uid is not already present ensure!(ImpactActions::contains_key(&uid)==false, Error::<T>::DuplicatedImpactAction); // check json validity let js=configuration.clone(); ensure!(json_check_validity(js),Error::<T>::InvalidJson); // check description let jsd=configuration.clone(); let description=json_get_value(jsd,"description".as_bytes().to_vec()); ensure!(description.len() >= 4, Error::<T>::TooShortDescription); //check minimum length for the description ensure!(description.len() <=1024, Error::<T>::TooLongDescription); //check maximum length for the description // check category let jsc=configuration.clone(); let category=json_get_value(jsc,"category".as_bytes().to_vec()); let category_slice=category.as_slice(); let category_str=match str::from_utf8(&category_slice){ Ok(f) => f, Err(_) => "0" }; let categoryvalue:u32 = match u32::from_str(category_str){ Ok(f) => f, Err(_) => 0, }; ensure!(Categories::contains_key(&categoryvalue)==true, Error::<T>::CategoryNotFound); // check number of auditors required let jsa=configuration.clone(); let auditors=json_get_value(jsa,"auditors".as_bytes().to_vec()); let auditors_slice=auditors.as_slice(); let auditors_str=match str::from_utf8(&auditors_slice){ Ok(f) => f, Err(_) => "0" }; let auditorsvalue:u32 = match u32::from_str(auditors_str){ Ok(f) => f, Err(_) => 0, }; ensure!(auditorsvalue > 0, Error::<T>::NumberofAuditorsCannotBeZero); // check startblock let jssb=configuration.clone(); let blockstart=json_get_value(jssb,"blockstart".as_bytes().to_vec()); let blockstart_slice=blockstart.as_slice(); let blockstart_str=match str::from_utf8(&blockstart_slice){ Ok(f) => f, Err(_) => "0" }; let blockstartvalue:u32 = match u32::from_str(blockstart_str){ Ok(f) => f, Err(_) => 0, }; ensure!(blockstartvalue > 0, Error::<T>::InvalidBlockStart); //check blockstart that must be > 0 // check block end let jseb=configuration.clone(); let blockend=json_get_value(jseb,"blockend".as_bytes().to_vec()); let blockend_slice=blockend.as_slice(); let blockend_str=match str::from_utf8(&blockend_slice){ Ok(f) => f, Err(_) => "0" }; let blockendvalue:u32 = match u32::from_str(blockend_str){ Ok(f) => f, Err(_) => 0, }; ensure!( blockendvalue> 0, Error::<T>::InvalidBlockEnd); //check blockend that must be > 0 // check rewards token let jsr=configuration.clone(); let rewardstoken=json_get_value(jsr,"rewardstoken".as_bytes().to_vec()); let rewardstoken_slice=rewardstoken.as_slice(); let rewardstoken_str=match str::from_utf8(&rewardstoken_slice){ Ok(f) => f, Err(_) => "-1" }; let rewardstokenvalue:i32 = match i32::from_str(rewardstoken_str){ Ok(f) => f, Err(_) => -1, }; ensure!(rewardstokenvalue >= 0, Error::<T>::InvalidRewardsToken); //check rewards token that must be >= 0 // check rewards amount let jsam=configuration.clone(); let rewardsamount=json_get_value(jsam,"rewardsamount".as_bytes().to_vec()); let rewardsamount_slice=rewardsamount.as_slice(); let rewardsamount_str=match str::from_utf8(&rewardsamount_slice){ Ok(f) => f, Err(_) => "0" }; let rewardsamountvalue:u32 = match u32::from_str(rewardsamount_str){ Ok(f) => f, Err(_) => 0, }; ensure!(rewardsamountvalue > 0, Error::<T>::InvalidRewardsAmount); //check rewards amount that must be > 0 // check rewards Oracle let jso=configuration.clone(); let rewardsoracle=json_get_value(jso,"rewardsoracle".as_bytes().to_vec()); let rewardsoracle_slice=rewardsoracle.as_slice(); let rewardsoracle_str=match str::from_utf8(&rewardsoracle_slice){ Ok(f) => f, Err(_) => "-1" }; let rewardsoraclevalue:i32 = match i32::from_str(rewardsoracle_str){ Ok(f) => f, Err(_) => -1, }; ensure!(rewardsoraclevalue >= 0, Error::<T>::InvalidRewardsOracle); //check rewards oracle that must be >= 0 // check rewards Auditors let jsau=configuration.clone(); let rewardsauditors=json_get_value(jsau,"rewardsauditors".as_bytes().to_vec()); let rewardsauditors_slice=rewardsauditors.as_slice(); let rewardsauditors_str=match str::from_utf8(&rewardsauditors_slice){ Ok(f) => f, Err(_) => "-1" }; let rewardsauditorsvalue:i32 = match i32::from_str(rewardsauditors_str){ Ok(f) => f, Err(_) => -1, }; ensure!(rewardsauditorsvalue >= 0, Error::<T>::InvalidRewardsAuditors); //check rewards auditors that must be >= 0 // check Slashing amount for Auditors let jsas=configuration.clone(); let slashingauditors=json_get_value(jsas,"slashingsauditors".as_bytes().to_vec()); let slashingauditors_slice=slashingauditors.as_slice(); let slashingauditors_str=match str::from_utf8(&slashingauditors_slice){ Ok(f) => f, Err(_) => "-1" }; let slashingauditorsvalue:i32 = match i32::from_str(slashingauditors_str){ Ok(f) => f, Err(_) => -1, }; ensure!(slashingauditorsvalue >= 0, Error::<T>::InvalidSlashingAuditors); //check slashing amount for auditors that must be >= 0 // check Max errors for revoking auditor let jsme=configuration.clone(); let maxerrorsauditor=json_get_value(jsme,"maxerrorsauditor".as_bytes().to_vec()); let maxerrorsauditor_slice=maxerrorsauditor.as_slice(); let maxerrorsauditor_str=match str::from_utf8(&maxerrorsauditor_slice){ Ok(f) => f, Err(_) => "0" }; let maxerrorsauditorvalue:u32 = match u32::from_str(maxerrorsauditor_str){ Ok(f) => f, Err(_) => 0, }; ensure!(maxerrorsauditorvalue > 0, Error::<T>::InvalidMaxErrorsAuditor); //check max errors for auditors before to be revoked, that must be > 0 // check custom fields let mut x=0; let mut vy = Vec::<u8>::new(); vy.push(b'Y'); let mut vn = Vec::<u8>::new(); vn.push(b'N'); let mut ftn = Vec::<u8>::new(); ftn.push(b'N'); let mut fts = Vec::<u8>::new(); fts.push(b'S'); let fields=json_get_complexarray(configuration.clone(),"fields".as_bytes().to_vec()); if fields.len()>0{ loop { let jr=json_get_recordvalue(fields.clone(),x); if jr.len()==0 { break; } let fieldname=json_get_value(jr.clone(),"fieldname".as_bytes().to_vec()); ensure!(fieldname.len() > 0, Error::<T>::FieldNameTooShort); //check minimum length for the fieldname let fieldtype=json_get_value(jr.clone(),"fieldtype".as_bytes().to_vec()); ensure!(fieldtype==fts || fieldtype==ftn, Error::<T>::FieldTypeIsWrong); let mandatory=json_get_value(jr.clone(),"mandatory".as_bytes().to_vec()); ensure!(mandatory==vn || mandatory==vy,Error::<T>::FieldMandatoryFlagIsWrong); x=x+1; } } // Insert configuration of the impact action ImpactActions::insert(uid,configuration.clone()); // Generate event Self::deposit_event(RawEvent::ImpactActionCreated(uid,configuration)); // Return a successful DispatchResult Ok(()) } /// Destroy an impact action #[weight = 1000] pub fn destroy_impact_action(origin, uid: u32) -> dispatch::DispatchResult { // check the request is signed from Super User let _sender = ensure_root(origin)?; // verify the impact action exists ensure!(ImpactActions::contains_key(&uid)==true, Error::<T>::ImpactActionNotFound); // Remove impact action ImpactActions::take(uid); // Generate event //it can leave orphans, anyway it's a decision of the super user Self::deposit_event(RawEvent::ImpactActionDestroyed(uid)); // Return a successful DispatchResult Ok(()) } /// Submit an approval request for an impact action #[weight = 10000] pub fn request_approval(origin, uid: u32, info: Vec<u8>) -> dispatch::DispatchResult { // check the request is signed let sender = ensure_signed(origin)?; //check info length ensure!(info.len()> 4, Error::<T>::TooShortInfo); ensure!(info.len()< 1024, Error::<T>::TooLongInfo); // check the id is > 0 ensure!(uid > 0, Error::<T>::UidCannotBeZero); // check json validity let js=info.clone(); ensure!(json_check_validity(js),Error::<T>::InvalidJson); // check impact action id let jsi=info.clone(); let impactactionid=json_get_value(jsi,"impactactionid".as_bytes().to_vec()); let impactactionid_slice=impactactionid.as_slice(); let impactactionid_str=match str::from_utf8(&impactactionid_slice){ Ok(f) => f, Err(_) => "0" }; let impactactionidvalue:u32 = match u32::from_str(impactactionid_str){ Ok(f) => f, Err(_) => 0, }; // check that the impactactionid is present ensure!(ImpactActions::contains_key(&impactactionidvalue)==true, Error::<T>::ImpactActionNotFound); // check that the uid is not already present ensure!(ApprovalRequests::contains_key(&uid)==false, Error::<T>::ImpactActionSubmissionDuplicated); // get the impact action configuration let impactaction=ImpactActions::get(&impactactionidvalue).unwrap(); // check that the block number is inside the frame configured let current_block = <frame_system::Module<T>>::block_number(); let bs=impactaction.clone(); let blockstart=json_get_value(bs,"blockstart".as_bytes().to_vec()); let blockstart_slice=blockstart.as_slice(); let blockstart_str=match str::from_utf8(&blockstart_slice){ Ok(f) => f, Err(_) => "0" }; let blockstartvalue:u32 = match u32::from_str(blockstart_str){ Ok(f) => f, Err(_) => 0, }; let blockend=json_get_value(impactaction,"blockend".as_bytes().to_vec()); let blockend_slice=blockend.as_slice(); let blockend_str=match str::from_utf8(&blockend_slice){ Ok(f) => f, Err(_) => "0" }; let blockendvalue:u32 = match u32::from_str(blockend_str){ Ok(f) => f, Err(_) => 0, }; ensure!(current_block>=blockstartvalue.into() && current_block<=blockendvalue.into(),Error::<T>::ImpactActionNotValid); // check for custom fields let configuration=ImpactActions::get(&impactactionidvalue).unwrap(); let customfields=json_get_complexarray(configuration,"fields".as_bytes().to_vec()); let mut x=0; let mut vy = Vec::<u8>::new(); vy.push(b'Y'); let mut vn = Vec::<u8>::new(); vn.push(b'N'); let mut ftn = Vec::<u8>::new(); ftn.push(b'N'); let mut fts = Vec::<u8>::new(); fts.push(b'S'); loop{ let field=json_get_recordvalue(customfields.clone(),x); if field.len()==0 { break; } let fieldname=json_get_value(field.clone(),"fieldname".as_bytes().to_vec()); let fieldtype=json_get_value(field.clone(),"fieldtype".as_bytes().to_vec()); let mandatory=json_get_value(field.clone(),"mandatory".as_bytes().to_vec()); // get the field from "info" let fieldvalue=json_get_value(info.clone(),fieldname); if mandatory==vy { ensure!(fieldvalue.len()>0,Error::<T>::MissingMandatoryCustomField); } // check for numeric field if fieldtype==ftn { let fieldvalue_slice=fieldvalue.as_slice(); let fieldvalue_str=match str::from_utf8(&fieldvalue_slice){ Ok(f) => f, Err(_) => "-999999999999" }; let fieldvaluec:i128 = match i128::from_str(fieldvalue_str){ Ok(f) => f, Err(_) => -999999999999, }; ensure!(fieldvaluec!=-999999999999,Error::<T>::CustomFieldNotNumeric); } // no check on string, we accept any kind of value x=x+1; } // Insert approval request ApprovalRequests::insert(uid,info); // Generate event Self::deposit_event(RawEvent::ImpactActionRequestApproval(sender,uid)); // Return a successful DispatchResult Ok(()) } /// Vote an approval request for an impact action from an auditor or an oracle #[weight = 1000] pub fn vote_approval_request(origin, approvalid: u32, vote: Vec<u8>) -> dispatch::DispatchResult { // check the request is signed let sender = ensure_signed(origin)?; //check info length ensure!(vote.len()>=4, Error::<T>::TooShortInfo); ensure!(vote.len()< 1024, Error::<T>::TooLongInfo); // check the uid is > 0 ensure!(approvalid > 0, Error::<T>::UidCannotBeZero); // check json validity let js=vote.clone(); ensure!(json_check_validity(js),Error::<T>::InvalidJson); // check vote Y/N let jsv=vote.clone(); let mut vy = Vec::<u8>::new(); vy.push(b'Y'); let mut vn = Vec::<u8>::new(); vn.push(b'N'); let votev=json_get_value(jsv,"vote".as_bytes().to_vec()); ensure!(votev==vy || votev==vn, Error::<T>::VoteIsInvalid); // check for otherinfo let jso=vote.clone(); let otherinfo=json_get_value(jso,"otherinfo".as_bytes().to_vec()); ensure!(otherinfo.len() >2 , Error::<T>::OtherInfoTooShort); //check minimum length for the otherinfo ensure!(otherinfo.len() <=1024, Error::<T>::OtherInfoTooLong); //check maximum length for the otherinfo // check that the approval id is present ensure!(ApprovalRequests::contains_key(&approvalid)==true, Error::<T>::ImpactActionSubmissionNotFound); // check that the auditor is assigned to the approval request ensure!(ApprovalRequestsAuditors::<T>::contains_key(&approvalid,&sender)==true, Error::<T>::SignerNotAssigneAsAuditor); // check that the vote is nor already present ensure!(ApprovalRequestsVotes::<T>::contains_key(&approvalid,&sender)==false, Error::<T>::VoteAlreadyPresent); // Insert approval request ApprovalRequestsVotes::<T>::insert(approvalid,sender.clone(),vote.clone()); // Generate event Self::deposit_event(RawEvent::ImpactActionRequestApprovalVoted(sender,approvalid,vote)); // Return a successful DispatchResult Ok(()) } /// Create a new category of impact actions #[weight = 1000] pub fn create_category(origin, uid: u32, description: Vec<u8>) -> dispatch::DispatchResult { // check the request is signed from Super User let _sender = ensure_root(origin)?; //check description length ensure!(description.len()> 4, Error::<T>::TooShortDescription); ensure!(description.len()< 128, Error::<T>::TooLongDescription); // check the id is > 0 ensure!(uid > 0, Error::<T>::UidCannotBeZero); // check that the uid is not already present ensure!(Categories::contains_key(&uid)==false, Error::<T>::DuplicatedCategoryImpactAction); // Update categories Categories::insert(uid,description.clone()); // Generate event Self::deposit_event(RawEvent::ImpactActionCategoryCreated(uid,description)); // Return a successful DispatchResult Ok(()) } /// Destroy a category of impact actions #[weight = 1000] pub fn destroy_category(origin, uid: u32) -> dispatch::DispatchResult { // check the request is signed from Super User let _sender = ensure_root(origin)?; // check the id is > 0 ensure!(uid > 0, Error::<T>::UidCannotBeZero); // check that the uid is already present ensure!(Categories::contains_key(&uid)==true, Error::<T>::CategoryImpactActionNotFound); // Update Categories Categories::take(uid); // Generate event Self::deposit_event(RawEvent::ImpactActionCategoryDestroyed(uid)); // Return a successful DispatchResult Ok(()) } /// Create a new auditor #[weight = 1000] pub fn create_auditor(origin, account: T::AccountId, configuration: Vec<u8>) -> dispatch::DispatchResult { // check the request is signed from Super User let _sender = ensure_root(origin)?; //check configuration length ensure!(configuration.len()> 12, Error::<T>::TooShortConfigurationLength); ensure!(configuration.len()< 8192, Error::<T>::TooLongConfigurationLength); // check that the account is not already present ensure!(Auditors::<T>::contains_key(&account)==false, Error::<T>::DuplicatedImpactActionAuditor); // check json validity let js=configuration.clone(); ensure!(json_check_validity(js),Error::<T>::InvalidJson); // check description let jsd=configuration.clone(); let description=json_get_value(jsd,"description".as_bytes().to_vec()); ensure!(description.len() >= 4, Error::<T>::TooShortDescription); //check minimum length for the description ensure!(description.len() <=1024, Error::<T>::TooLongDescription); //check maximum length for the description // check categories let jsc=configuration.clone(); let categories=json_get_value(jsc,"categories".as_bytes().to_vec()); ensure!(categories.len() >= 1, Error::<T>::TooShortCategories); //check minimum length for the categories ensure!(categories.len() <=256, Error::<T>::TooLongCategories); //check maximum length for the categories //frame_support::debug::info!("[DEBUG]****************************************** categories {:?}", categories); // check categories that must be present let mut x=0; loop { let category=json_get_arrayvalue(categories.clone(),x); if category.len()==0 { break; } // convert category from vec to u32 let category_slice=category.as_slice(); let category_str=match str::from_utf8(&category_slice){ Ok(f) => f, Err(_) => "0" }; let categoryvalue:u32 = match u32::from_str(category_str){ Ok(f) => f, Err(_) => 0, }; ensure!(categoryvalue >0, Error::<T>::CategoryCannotBeZero); ensure!(Categories::contains_key(&categoryvalue)==true, Error::<T>::CategoryNotFound); x=x+1; } let jsd=configuration.clone(); let area=json_get_value(jsd,"area".as_bytes().to_vec()); ensure!(area.len() >= 4, Error::<T>::TooShortArea); //check minimum length for the area ensure!(area.len() <=128, Error::<T>::TooLongArea); //check maximum length for the area // check otherinfo let jso=configuration.clone(); let otherinfo=json_get_value(jso,"otherinfo".as_bytes().to_vec()); ensure!(otherinfo.len() <=1024, Error::<T>::TooLongOtherInfo); //check maximum length for the other info // check minimum stakes required let jsms=configuration.clone(); let stakesmin=json_get_value(jsms,"stakesmin".as_bytes().to_vec()); let stakesmin_slice=stakesmin.as_slice(); let stakesmin_str=match str::from_utf8(&stakesmin_slice){ Ok(f) => f, Err(_) => "-1" }; let stakesminvalue:i32 = match i32::from_str(stakesmin_str){ Ok(f) => f, Err(_) => -1, }; ensure!(stakesminvalue >= -1, Error::<T>::InvalidStakesMinimum); //check stakes that must be >= 0 // insert new auditor Auditors::<T>::insert(account.clone(),configuration.clone()); // Generate event Self::deposit_event(RawEvent::ImpactActionAuditorCreated(account,configuration)); // Return a successful DispatchResult Ok(()) } /// Destroy an auditor #[weight = 1000] pub fn destroy_auditor(origin, account: T::AccountId) -> dispatch::DispatchResult { // check the request is signed from Super User let _sender = ensure_root(origin)?; // check that the uid is already present ensure!(Auditors::<T>::contains_key(&account)==true, Error::<T>::AuditorImpactActionNotFound); // Update Auditor Auditors::<T>::take(account.clone()); // Generate event Self::deposit_event(RawEvent::ImpactActionAuditorDestroyed(account)); // Return a successful DispatchResult Ok(()) } /// Assign an auditor #[weight = 1000] pub fn assign_auditor(origin, approvalid: u32, auditor: T::AccountId, maxdays: u32) -> dispatch::DispatchResult { // get the proxy account used for assigning the auditor ensure!(Proxy::<T>::contains_key(0)==true, Error::<T>::ProxyAccountNotConfigured); let proxy=Proxy::<T>::get(0).unwrap(); // check the request is signed from Authorised Proxy let sender = ensure_signed(origin)?; ensure!(sender==proxy,Error::<T>::SigningAccountNotValidProxy); // check the uid is > 0 ensure!(approvalid > 0, Error::<T>::UidCannotBeZero); // check that the uid is already present ensure!(ApprovalRequests::contains_key(&approvalid)==true, Error::<T>::ImpactActionSubmissionNotFound); // check that the auditor is already present ensure!(Auditors::<T>::contains_key(&auditor)==true, Error::<T>::AuditorImpactActionNotFound); // check the max days >0 ensure!(maxdays > 0, Error::<T>::MaxDaysCannotBeZero); // Update Assigned Auditors ApprovalRequestsAuditors::<T>::insert(approvalid,auditor.clone(),maxdays); // Generate event Self::deposit_event(RawEvent::ImpactActionAuditorAssigned(approvalid,auditor,maxdays)); // Return a successful DispatchResult Ok(()) } /// Destroy an impact action #[weight = 1000] pub fn destroy_assigned_auditor(origin, approvalid: u32, auditor: T::AccountId) -> dispatch::DispatchResult { // get the proxy account used for assigning the auditor ensure!(Proxy::<T>::contains_key(0)==true, Error::<T>::ProxyAccountNotConfigured); let proxy=Proxy::<T>::get(0).unwrap(); // check the request is signed from Authorised Proxy let sender = ensure_signed(origin)?; ensure!(sender==proxy,Error::<T>::SigningAccountNotValidProxy); // verify the assigned editor exists ensure!(ApprovalRequestsAuditors::<T>::contains_key(&approvalid,&auditor)==true, Error::<T>::AssignedAuditorNotFound); // Remove impact action ApprovalRequestsAuditors::<T>::take(&approvalid,&auditor); // Generate event //it can leave orphans, anyway it's a decision of the super user Self::deposit_event(RawEvent::AssignedAuditorDestroyed(approvalid,auditor)); // Return a successful DispatchResult Ok(()) } /// Create a new oracle #[weight = 1000] pub fn create_oracle(origin, uid: u32, configuration: Vec<u8>) -> dispatch::DispatchResult { // check the request is signed from Super User let _sender = ensure_root(origin)?; //check configuration length ensure!(configuration.len()> 4, Error::<T>::TooShortConfigurationLength); ensure!(configuration.len() < 1024, Error::<T>::TooLongConfigurationLength); // check the id is > 0 ensure!(uid > 0, Error::<T>::UidCannotBeZero); // check that the uid is not already present ensure!(Oracles::contains_key(&uid)==false, Error::<T>::DuplicatedImpactAction); // check json validity let js=configuration.clone(); ensure!(json_check_validity(js),Error::<T>::InvalidJson); // check description let jsd=configuration.clone(); let description=json_get_value(jsd,"description".as_bytes().to_vec()); ensure!(description.len() >= 4, Error::<T>::TooShortDescription); //check minimum length for the description ensure!(description.len() <=1024, Error::<T>::TooLongDescription); //check maximum length for the description // check accountid in base58 let jsc=configuration.clone(); let oracleaccount=json_get_value(jsc,"account".as_bytes().to_vec()); ensure!(oracleaccount.len() == 48, Error::<T>::OracleAccountNotValid); //check length for the account // check other info field as mandatory let jso=configuration.clone(); let otherinfo=json_get_value(jso,"otherinfo".as_bytes().to_vec()); ensure!(otherinfo.len() > 0, Error::<T>::OtherInfoMissing); Oracles::insert(uid,configuration.clone()); // Generate event Self::deposit_event(RawEvent::ImpactActionOracleCreated(uid,configuration)); // Return a successful DispatchResult Ok(()) } /// Destroy an oracle #[weight = 1000] pub fn destroy_oracle(origin, uid: u32) -> dispatch::DispatchResult { // check the request is signed from Super User let _sender = ensure_root(origin)?; // check the id is > 0 ensure!(uid > 0, Error::<T>::UidCannotBeZero); // check that the uid is already present ensure!(Oracles::contains_key(&uid)==true, Error::<T>::OracleImpactActionNotFound); // Update Categories Oracles::take(uid); // Generate event Self::deposit_event(RawEvent::ImpactActionOracleDestroyed(uid)); // Return a successful DispatchResult Ok(()) } /// Create a new proxy account (uid=0 for Assigning Auditors) #[weight = 1000] pub fn create_proxy(origin, uid: u32, proxy: T::AccountId) -> dispatch::DispatchResult { // check the request is signed from Super User let _sender = ensure_root(origin)?; // check that the uid is not already present ensure!(Proxy::<T>::contains_key(&uid)==false, Error::<T>::DuplicatedProxyId); // insert the proxy account Proxy::<T>::insert(uid,proxy); // Generate event Self::deposit_event(RawEvent::ImpactActionProxyCreated(uid)); // Return a successful DispatchResult Ok(()) } /// Destroy a proxy account #[weight = 1000] pub fn destroy_proxy(origin, uid: u32) -> dispatch::DispatchResult { // check the request is signed from Super User let _sender = ensure_root(origin)?; // check the id is > 0 ensure!(uid > 0, Error::<T>::UidCannotBeZero); // check that the uid is already present ensure!(Proxy::<T>::contains_key(&uid)==true, Error::<T>::ProxyAccountNotFound); // Update Categories Proxy::<T>::take(uid); // Generate event Self::deposit_event(RawEvent::ImpactActionProxyDestroyed(uid)); // Return a successful DispatchResult Ok(()) } } } // function to validate a json string for no/std. It does not allocate of memory fn json_check_validity(j:Vec<u8>) -> bool{ // minimum lenght of 2 if j.len()<2 { return false; } // checks star/end with {} if *j.get(0).unwrap()==b'{' && *j.get(j.len()-1).unwrap()!=b'}' { return false; } // checks start/end with [] if *j.get(0).unwrap()==b'[' && *j.get(j.len()-1).unwrap()!=b']' { return false; } // check that the start is { or [ if *j.get(0).unwrap()!=b'{' && *j.get(0).unwrap()!=b'[' { return false; } //checks that end is } or ] if *j.get(j.len()-1).unwrap()!=b'}' && *j.get(j.len()-1).unwrap()!=b']' { return false; } //checks " opening/closing and : as separator between name and values let mut s:bool=true; let mut d:bool=true; let mut pg:bool=true; let mut ps:bool=true; let mut bp = b' '; for b in j { if b==b'[' && s { ps=false; } if b==b']' && s && ps==false { ps=true; } else if b==b']' && s && ps==true { ps=false; } if b==b'{' && s { pg=false; } if b==b'}' && s && pg==false { pg=true; } else if b==b'}' && s && pg==true { pg=false; } if b == b'"' && s && bp != b'\\' { s=false; bp=b; d=false; continue; } if b == b':' && s { d=true; bp=b; continue; } if b == b'"' && !s && bp != b'\\' { s=true; bp=b; d=true; continue; } bp=b; } //fields are not closed properly if !s { return false; } //fields are not closed properly if !d { return false; } //fields are not closed properly if !ps { return false; } // every ok returns true return true; } // function to get record {} from multirecord json structure [{..},{.. }], it returns an empty Vec when the records is not present fn json_get_recordvalue(ar:Vec<u8>,p:i32) -> Vec<u8> { let mut result=Vec::new(); let mut op=true; let mut cn=0; let mut lb=b' '; for b in ar { if b==b',' && op==true { cn=cn+1; continue; } if b==b'[' && op==true && lb!=b'\\' { continue; } if b==b']' && op==true && lb!=b'\\' { continue; } if b==b'{' && op==true && lb!=b'\\' { op=false; } if b==b'}' && op==false && lb!=b'\\' { op=true; } // field found if cn==p { result.push(b); } lb=b.clone(); } return result; } // function to get a field value from array field [1,2,3,4,100], it returns an empty Vec when the records is not present fn json_get_arrayvalue(ar:Vec<u8>,p:i32) -> Vec<u8> { let mut result=Vec::new(); let mut op=true; let mut cn=0; let mut lb=b' '; for b in ar { if b==b',' && op==true { cn=cn+1; continue; } if b==b'[' && op==true && lb!=b'\\' { continue; } if b==b']' && op==true && lb!=b'\\' { continue; } if b==b'"' && op==true && lb!=b'\\' { continue; } if b==b'"' && op==true && lb!=b'\\' { op=false; } if b==b'"' && op==false && lb!=b'\\' { op=true; } // field found if cn==p { result.push(b); } lb=b.clone(); } return result; } // function to get value of a field for Substrate runtime (no std library and no variable allocation) fn json_get_value(j:Vec<u8>,key:Vec<u8>) -> Vec<u8> { let mut result=Vec::new(); let mut k=Vec::new(); let keyl = key.len(); let jl = j.len(); k.push(b'"'); for xk in 0..keyl{ k.push(*key.get(xk).unwrap()); } k.push(b'"'); k.push(b':'); let kl = k.len(); for x in 0..jl { let mut m=0; let mut xx=0; if x+kl>jl { break; } for i in x..x+kl { if *j.get(i).unwrap()== *k.get(xx).unwrap() { m=m+1; } xx=xx+1; } if m==kl{ let mut lb=b' '; let mut op=true; let mut os=true; for i in x+kl..jl-1 { if *j.get(i).unwrap()==b'[' && op==true && os==true{ os=false; } if *j.get(i).unwrap()==b'}' && op==true && os==false{ os=true; } if *j.get(i).unwrap()==b':' && op==true{ continue; } if *j.get(i).unwrap()==b'"' && op==true && lb!=b'\\' { op=false; continue } if *j.get(i).unwrap()==b'"' && op==false && lb!=b'\\' { break; } if *j.get(i).unwrap()==b'}' && op==true{ break; } if *j.get(i).unwrap()==b']' && op==true{ break; } if *j.get(i).unwrap()==b',' && op==true && os==true{ break; } result.push(j.get(i).unwrap().clone()); lb=j.get(i).unwrap().clone(); } break; } } return result; } // function to get value of a field with a complex array like [{....},{.....}] for Substrate runtime (no std library and no variable allocation) fn json_get_complexarray(j:Vec<u8>,key:Vec<u8>) -> Vec<u8> { let mut result=Vec::new(); let mut k=Vec::new(); let keyl = key.len(); let jl = j.len(); k.push(b'"'); for xk in 0..keyl{ k.push(*key.get(xk).unwrap()); } k.push(b'"'); k.push(b':'); let kl = k.len(); for x in 0..jl { let mut m=0; let mut xx=0; if x+kl>jl { break; } for i in x..x+kl { if *j.get(i).unwrap()== *k.get(xx).unwrap() { m=m+1; } xx=xx+1; } if m==kl{ let mut os=true; for i in x+kl..jl-1 { if *j.get(i).unwrap()==b'[' && os==true{ os=false; } result.push(j.get(i).unwrap().clone()); if *j.get(i).unwrap()==b']' && os==false { break; } } break; } } return result; }
#![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 II2cControllerProvider(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for II2cControllerProvider { type Vtable = II2cControllerProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x61c2bb82_4510_4163_a87c_4e15a9558980); } impl II2cControllerProvider { pub fn GetDeviceProvider<'a, Param0: ::windows::core::IntoParam<'a, ProviderI2cConnectionSettings>>(&self, settings: Param0) -> ::windows::core::Result<II2cDeviceProvider> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), settings.into_param().abi(), &mut result__).from_abi::<II2cDeviceProvider>(result__) } } } unsafe impl ::windows::core::RuntimeType for II2cControllerProvider { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{61c2bb82-4510-4163-a87c-4e15a9558980}"); } impl ::core::convert::From<II2cControllerProvider> for ::windows::core::IUnknown { fn from(value: II2cControllerProvider) -> Self { value.0 .0 } } impl ::core::convert::From<&II2cControllerProvider> for ::windows::core::IUnknown { fn from(value: &II2cControllerProvider) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for II2cControllerProvider { 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 II2cControllerProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<II2cControllerProvider> for ::windows::core::IInspectable { fn from(value: II2cControllerProvider) -> Self { value.0 } } impl ::core::convert::From<&II2cControllerProvider> for ::windows::core::IInspectable { fn from(value: &II2cControllerProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for II2cControllerProvider { 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 II2cControllerProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct II2cControllerProvider_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, settings: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct II2cDeviceProvider(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for II2cDeviceProvider { type Vtable = II2cDeviceProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xad342654_57e8_453e_8329_d1e447d103a9); } impl II2cDeviceProvider { #[cfg(feature = "Foundation")] pub fn Close(&self) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::super::super::Foundation::IClosable>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this)).ok() } } pub fn DeviceId(&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 Write(&self, buffer: &[<u8 as ::windows::core::DefaultType>::DefaultType]) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), buffer.len() as u32, ::core::mem::transmute(buffer.as_ptr())).ok() } } pub fn WritePartial(&self, buffer: &[<u8 as ::windows::core::DefaultType>::DefaultType]) -> ::windows::core::Result<ProviderI2cTransferResult> { let this = self; unsafe { let mut result__: ProviderI2cTransferResult = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), buffer.len() as u32, ::core::mem::transmute(buffer.as_ptr()), &mut result__).from_abi::<ProviderI2cTransferResult>(result__) } } pub fn Read(&self, buffer: &mut [<u8 as ::windows::core::DefaultType>::DefaultType]) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), buffer.len() as u32, ::core::mem::transmute_copy(&buffer)).ok() } } pub fn ReadPartial(&self, buffer: &mut [<u8 as ::windows::core::DefaultType>::DefaultType]) -> ::windows::core::Result<ProviderI2cTransferResult> { let this = self; unsafe { let mut result__: ProviderI2cTransferResult = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), buffer.len() as u32, ::core::mem::transmute_copy(&buffer), &mut result__).from_abi::<ProviderI2cTransferResult>(result__) } } pub fn WriteRead(&self, writebuffer: &[<u8 as ::windows::core::DefaultType>::DefaultType], readbuffer: &mut [<u8 as ::windows::core::DefaultType>::DefaultType]) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), writebuffer.len() as u32, ::core::mem::transmute(writebuffer.as_ptr()), readbuffer.len() as u32, ::core::mem::transmute_copy(&readbuffer)).ok() } } pub fn WriteReadPartial(&self, writebuffer: &[<u8 as ::windows::core::DefaultType>::DefaultType], readbuffer: &mut [<u8 as ::windows::core::DefaultType>::DefaultType]) -> ::windows::core::Result<ProviderI2cTransferResult> { let this = self; unsafe { let mut result__: ProviderI2cTransferResult = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), writebuffer.len() as u32, ::core::mem::transmute(writebuffer.as_ptr()), readbuffer.len() as u32, ::core::mem::transmute_copy(&readbuffer), &mut result__).from_abi::<ProviderI2cTransferResult>(result__) } } } unsafe impl ::windows::core::RuntimeType for II2cDeviceProvider { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{ad342654-57e8-453e-8329-d1e447d103a9}"); } impl ::core::convert::From<II2cDeviceProvider> for ::windows::core::IUnknown { fn from(value: II2cDeviceProvider) -> Self { value.0 .0 } } impl ::core::convert::From<&II2cDeviceProvider> for ::windows::core::IUnknown { fn from(value: &II2cDeviceProvider) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for II2cDeviceProvider { 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 II2cDeviceProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<II2cDeviceProvider> for ::windows::core::IInspectable { fn from(value: II2cDeviceProvider) -> Self { value.0 } } impl ::core::convert::From<&II2cDeviceProvider> for ::windows::core::IInspectable { fn from(value: &II2cDeviceProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for II2cDeviceProvider { 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 II2cDeviceProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<II2cDeviceProvider> for super::super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: II2cDeviceProvider) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<&II2cDeviceProvider> for super::super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: &II2cDeviceProvider) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::super::Foundation::IClosable> for II2cDeviceProvider { fn into_param(self) -> ::windows::core::Param<'a, super::super::super::Foundation::IClosable> { ::windows::core::IntoParam::into_param(&self) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::super::Foundation::IClosable> for &II2cDeviceProvider { fn into_param(self) -> ::windows::core::Param<'a, super::super::super::Foundation::IClosable> { ::core::convert::TryInto::<super::super::super::Foundation::IClosable>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(C)] #[doc(hidden)] pub struct II2cDeviceProvider_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, buffer_array_size: u32, buffer: *const u8) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, buffer_array_size: u32, buffer: *const u8, result__: *mut ProviderI2cTransferResult) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, buffer_array_size: u32, buffer: *mut u8) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, buffer_array_size: u32, buffer: *mut u8, result__: *mut ProviderI2cTransferResult) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, writeBuffer_array_size: u32, writebuffer: *const u8, readBuffer_array_size: u32, readbuffer: *mut u8) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, writeBuffer_array_size: u32, writebuffer: *const u8, readBuffer_array_size: u32, readbuffer: *mut u8, result__: *mut ProviderI2cTransferResult) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct II2cProvider(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for II2cProvider { type Vtable = II2cProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6f13083e_bf62_4fe2_a95a_f08999669818); } impl II2cProvider { #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub fn GetControllersAsync(&self) -> ::windows::core::Result<super::super::super::Foundation::IAsyncOperation<super::super::super::Foundation::Collections::IVectorView<II2cControllerProvider>>> { 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::<super::super::super::Foundation::IAsyncOperation<super::super::super::Foundation::Collections::IVectorView<II2cControllerProvider>>>(result__) } } } unsafe impl ::windows::core::RuntimeType for II2cProvider { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{6f13083e-bf62-4fe2-a95a-f08999669818}"); } impl ::core::convert::From<II2cProvider> for ::windows::core::IUnknown { fn from(value: II2cProvider) -> Self { value.0 .0 } } impl ::core::convert::From<&II2cProvider> for ::windows::core::IUnknown { fn from(value: &II2cProvider) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for II2cProvider { 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 II2cProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<II2cProvider> for ::windows::core::IInspectable { fn from(value: II2cProvider) -> Self { value.0 } } impl ::core::convert::From<&II2cProvider> for ::windows::core::IInspectable { fn from(value: &II2cProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for II2cProvider { 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 II2cProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct II2cProvider_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(all(feature = "Foundation", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Foundation_Collections")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IProviderI2cConnectionSettings(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IProviderI2cConnectionSettings { type Vtable = IProviderI2cConnectionSettings_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe9db4e34_e510_44b7_809d_f2f85b555339); } #[repr(C)] #[doc(hidden)] pub struct IProviderI2cConnectionSettings_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 i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ProviderI2cBusSpeed) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ProviderI2cBusSpeed) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ProviderI2cSharingMode) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ProviderI2cSharingMode) -> ::windows::core::HRESULT, ); #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct ProviderI2cBusSpeed(pub i32); impl ProviderI2cBusSpeed { pub const StandardMode: ProviderI2cBusSpeed = ProviderI2cBusSpeed(0i32); pub const FastMode: ProviderI2cBusSpeed = ProviderI2cBusSpeed(1i32); } impl ::core::convert::From<i32> for ProviderI2cBusSpeed { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ProviderI2cBusSpeed { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for ProviderI2cBusSpeed { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.I2c.Provider.ProviderI2cBusSpeed;i4)"); } impl ::windows::core::DefaultType for ProviderI2cBusSpeed { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ProviderI2cConnectionSettings(pub ::windows::core::IInspectable); impl ProviderI2cConnectionSettings { pub fn SlaveAddress(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } pub fn SetSlaveAddress(&self, value: i32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value).ok() } } pub fn BusSpeed(&self) -> ::windows::core::Result<ProviderI2cBusSpeed> { let this = self; unsafe { let mut result__: ProviderI2cBusSpeed = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<ProviderI2cBusSpeed>(result__) } } pub fn SetBusSpeed(&self, value: ProviderI2cBusSpeed) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value).ok() } } pub fn SharingMode(&self) -> ::windows::core::Result<ProviderI2cSharingMode> { let this = self; unsafe { let mut result__: ProviderI2cSharingMode = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<ProviderI2cSharingMode>(result__) } } pub fn SetSharingMode(&self, value: ProviderI2cSharingMode) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value).ok() } } } unsafe impl ::windows::core::RuntimeType for ProviderI2cConnectionSettings { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Devices.I2c.Provider.ProviderI2cConnectionSettings;{e9db4e34-e510-44b7-809d-f2f85b555339})"); } unsafe impl ::windows::core::Interface for ProviderI2cConnectionSettings { type Vtable = IProviderI2cConnectionSettings_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe9db4e34_e510_44b7_809d_f2f85b555339); } impl ::windows::core::RuntimeName for ProviderI2cConnectionSettings { const NAME: &'static str = "Windows.Devices.I2c.Provider.ProviderI2cConnectionSettings"; } impl ::core::convert::From<ProviderI2cConnectionSettings> for ::windows::core::IUnknown { fn from(value: ProviderI2cConnectionSettings) -> Self { value.0 .0 } } impl ::core::convert::From<&ProviderI2cConnectionSettings> for ::windows::core::IUnknown { fn from(value: &ProviderI2cConnectionSettings) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ProviderI2cConnectionSettings { 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 ProviderI2cConnectionSettings { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ProviderI2cConnectionSettings> for ::windows::core::IInspectable { fn from(value: ProviderI2cConnectionSettings) -> Self { value.0 } } impl ::core::convert::From<&ProviderI2cConnectionSettings> for ::windows::core::IInspectable { fn from(value: &ProviderI2cConnectionSettings) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ProviderI2cConnectionSettings { 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 ProviderI2cConnectionSettings { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for ProviderI2cConnectionSettings {} unsafe impl ::core::marker::Sync for ProviderI2cConnectionSettings {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct ProviderI2cSharingMode(pub i32); impl ProviderI2cSharingMode { pub const Exclusive: ProviderI2cSharingMode = ProviderI2cSharingMode(0i32); pub const Shared: ProviderI2cSharingMode = ProviderI2cSharingMode(1i32); } impl ::core::convert::From<i32> for ProviderI2cSharingMode { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ProviderI2cSharingMode { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for ProviderI2cSharingMode { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.I2c.Provider.ProviderI2cSharingMode;i4)"); } impl ::windows::core::DefaultType for ProviderI2cSharingMode { type DefaultType = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct ProviderI2cTransferResult { pub Status: ProviderI2cTransferStatus, pub BytesTransferred: u32, } impl ProviderI2cTransferResult {} impl ::core::default::Default for ProviderI2cTransferResult { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for ProviderI2cTransferResult { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("ProviderI2cTransferResult").field("Status", &self.Status).field("BytesTransferred", &self.BytesTransferred).finish() } } impl ::core::cmp::PartialEq for ProviderI2cTransferResult { fn eq(&self, other: &Self) -> bool { self.Status == other.Status && self.BytesTransferred == other.BytesTransferred } } impl ::core::cmp::Eq for ProviderI2cTransferResult {} unsafe impl ::windows::core::Abi for ProviderI2cTransferResult { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for ProviderI2cTransferResult { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"struct(Windows.Devices.I2c.Provider.ProviderI2cTransferResult;enum(Windows.Devices.I2c.Provider.ProviderI2cTransferStatus;i4);u4)"); } impl ::windows::core::DefaultType for ProviderI2cTransferResult { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct ProviderI2cTransferStatus(pub i32); impl ProviderI2cTransferStatus { pub const FullTransfer: ProviderI2cTransferStatus = ProviderI2cTransferStatus(0i32); pub const PartialTransfer: ProviderI2cTransferStatus = ProviderI2cTransferStatus(1i32); pub const SlaveAddressNotAcknowledged: ProviderI2cTransferStatus = ProviderI2cTransferStatus(2i32); } impl ::core::convert::From<i32> for ProviderI2cTransferStatus { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for ProviderI2cTransferStatus { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for ProviderI2cTransferStatus { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Devices.I2c.Provider.ProviderI2cTransferStatus;i4)"); } impl ::windows::core::DefaultType for ProviderI2cTransferStatus { type DefaultType = Self; }
use io_uring_callback::{Fd, Handle}; #[cfg(feature = "sgx")] use sgx_untrusted_alloc::UntrustedAllocator; use std::mem::ManuallyDrop; #[cfg(feature = "sgx")] use std::prelude::v1::*; #[cfg(not(feature = "sgx"))] use std::sync::{Arc, Mutex}; #[cfg(feature = "sgx")] use std::sync::{Arc, SgxMutex as Mutex}; use crate::io::{Common, IoUringProvider}; use crate::poll::{Events, Pollee, Poller}; pub struct Connector<P: IoUringProvider> { common: Arc<Common<P>>, // A pollee that is used by the connector privately. Not the one in common, // which is shared by all components (e.g., sender) of a socket. private_pollee: Pollee, inner: Mutex<Inner>, } struct Inner { pending_io: Option<Handle>, is_shutdown: bool, addr: ManuallyDrop<*mut libc::sockaddr_in>, #[cfg(feature = "sgx")] addr_alloc: ManuallyDrop<UntrustedAllocator>, } unsafe impl Send for Inner {} impl<P: IoUringProvider> Connector<P> { pub(crate) fn new(common: Arc<Common<P>>) -> Self { let inner = Mutex::new(Inner::new()); let private_pollee = Pollee::new(Events::empty()); Self { common, private_pollee, inner, } } pub async fn connect(self: &Arc<Self>, addr: &libc::sockaddr_in) -> i32 { // Initiate the async connect { let mut inner = self.inner.lock().unwrap(); if inner.is_shutdown { return -libc::EPIPE; } // This method should be called once debug_assert!(inner.pending_io.is_some()); unsafe { **inner.addr = *addr; } let handle = self.initiate_async_connect(*inner.addr as *const libc::sockaddr_in); inner.pending_io.replace(handle); } // Wait for the async connect to complete let mut poller = Poller::new(); let events = self.private_pollee.poll_by(Events::IN, Some(&mut poller)); if events.is_empty() { poller.wait().await; } // Finish the async connect { let inner = self.inner.lock().unwrap(); let handle = inner.pending_io.as_ref().unwrap(); handle.retval().unwrap() } } fn initiate_async_connect(self: &Arc<Self>, addr: *const libc::sockaddr_in) -> Handle { let connector = self.clone(); let callback = move |retval: i32| { debug_assert!(retval <= 0); if retval == 0 { connector.private_pollee.add(Events::IN); } else { connector.private_pollee.add(Events::ERR); } }; let io_uring = self.common.io_uring(); let handle = unsafe { io_uring.connect( Fd(self.common.fd()), addr as *const libc::sockaddr, core::mem::size_of::<libc::sockaddr_in>() as u32, callback, ) }; handle } pub fn is_shutdown(&self) -> bool { let inner = self.inner.lock().unwrap(); inner.is_shutdown } pub fn shutdown(&self) { let mut inner = self.inner.lock().unwrap(); inner.is_shutdown = true; drop(inner); // Wake up the blocking connect method self.private_pollee.add(Events::HUP); } } impl Inner { pub fn new() -> Self { #[cfg(not(feature = "sgx"))] let addr: *mut libc::sockaddr_in = Box::into_raw(Box::new(unsafe { std::mem::zeroed() })); #[cfg(feature = "sgx")] let addr_alloc = UntrustedAllocator::new(core::mem::size_of::<libc::sockaddr_in>(), 8).unwrap(); #[cfg(feature = "sgx")] let addr = addr_alloc.as_mut_ptr() as *mut libc::sockaddr_in; Self { pending_io: None, is_shutdown: false, addr: ManuallyDrop::new(addr), #[cfg(feature = "sgx")] addr_alloc: ManuallyDrop::new(addr_alloc), } } } impl Drop for Inner { fn drop(&mut self) { unsafe { #[cfg(not(feature = "sgx"))] drop(Box::from_raw(*self.addr)); ManuallyDrop::drop(&mut self.addr); #[cfg(feature = "sgx")] ManuallyDrop::drop(&mut self.addr_alloc); } } }
// 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::fmt::Debug; use std::fmt::Formatter; use std::sync::Arc; use common_base::base::tokio; use common_catalog::plan::PartInfoPtr; use common_catalog::table_context::TableContext; use common_exception::Result; use common_expression::BlockMetaInfo; use common_expression::DataBlock; use common_pipeline_core::processors::port::OutputPort; use common_pipeline_core::processors::processor::Event; use common_pipeline_core::processors::processor::ProcessorPtr; use common_pipeline_core::processors::Processor; use common_pipeline_sources::SyncSource; use common_pipeline_sources::SyncSourcer; use serde::Deserializer; use serde::Serializer; use crate::parquet_reader::IndexedReaders; use crate::parquet_reader::ParquetReader; pub struct ParquetSourceMeta { pub parts: Vec<PartInfoPtr>, /// The readers' order is the same of column nodes of the source schema. pub readers: Vec<IndexedReaders>, } impl Debug for ParquetSourceMeta { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { f.debug_struct("ParquetSourceMeta") .field("part", &self.parts) .finish() } } impl serde::Serialize for ParquetSourceMeta { fn serialize<S>(&self, _: S) -> common_exception::Result<S::Ok, S::Error> where S: Serializer { unimplemented!("Unimplemented serialize ParquetSourceMeta") } } impl<'de> serde::Deserialize<'de> for ParquetSourceMeta { fn deserialize<D>(_: D) -> common_exception::Result<Self, D::Error> where D: Deserializer<'de> { unimplemented!("Unimplemented deserialize ParquetSourceMeta") } } #[typetag::serde(name = "parquet_source")] impl BlockMetaInfo for ParquetSourceMeta { fn as_any(&self) -> &dyn Any { self } fn equals(&self, _: &Box<dyn BlockMetaInfo>) -> bool { unimplemented!("Unimplemented equals ParquetSourceMeta") } fn clone_self(&self) -> Box<dyn BlockMetaInfo> { unimplemented!("Unimplemented clone ParquetSourceMeta") } } pub struct SyncParquetSource { ctx: Arc<dyn TableContext>, block_reader: Arc<ParquetReader>, } impl SyncParquetSource { pub fn create( ctx: Arc<dyn TableContext>, output: Arc<OutputPort>, block_reader: Arc<ParquetReader>, ) -> Result<ProcessorPtr> { SyncSourcer::create(ctx.clone(), output, SyncParquetSource { ctx, block_reader }) } } impl SyncSource for SyncParquetSource { const NAME: &'static str = "SyncParquetSource"; fn generate(&mut self) -> Result<Option<DataBlock>> { match self.ctx.get_partition() { None => Ok(None), Some(part) => Ok(Some(DataBlock::empty_with_meta(Box::new( ParquetSourceMeta { parts: vec![part.clone()], readers: vec![self.block_reader.readers_from_blocking_io(part)?], }, )))), } } } pub struct AsyncParquetSource { finished: bool, batch_size: usize, ctx: Arc<dyn TableContext>, block_reader: Arc<ParquetReader>, output: Arc<OutputPort>, output_data: Option<(Vec<PartInfoPtr>, Vec<IndexedReaders>)>, } impl AsyncParquetSource { pub fn create( ctx: Arc<dyn TableContext>, output: Arc<OutputPort>, block_reader: Arc<ParquetReader>, ) -> Result<ProcessorPtr> { let batch_size = ctx.get_settings().get_storage_fetch_part_num()? as usize; Ok(ProcessorPtr::create(Box::new(AsyncParquetSource { ctx, output, batch_size, block_reader, finished: false, output_data: None, }))) } } #[async_trait::async_trait] impl Processor for AsyncParquetSource { fn name(&self) -> String { String::from("AsyncParquetSource") } fn as_any(&mut self) -> &mut dyn Any { self } fn event(&mut self) -> Result<Event> { if self.finished { self.output.finish(); return Ok(Event::Finished); } if self.output.is_finished() { return Ok(Event::Finished); } if !self.output.can_push() { return Ok(Event::NeedConsume); } if let Some((parts, readers)) = self.output_data.take() { let output = DataBlock::empty_with_meta(Box::new(ParquetSourceMeta { parts, readers })); self.output.push_data(Ok(output)); } Ok(Event::Async) } async fn async_process(&mut self) -> Result<()> { let parts = self.ctx.get_partitions(self.batch_size); if !parts.is_empty() { let mut readers = Vec::with_capacity(parts.len()); for part in &parts { let part = part.clone(); let block_reader = self.block_reader.clone(); readers.push(async move { let handler = tokio::spawn(async move { block_reader.readers_from_non_blocking_io(part).await }); handler.await.unwrap() }); } self.output_data = Some((parts, futures::future::try_join_all(readers).await?)); return Ok(()); } self.finished = true; Ok(()) } }
// $ cargo run --example into_iter #![allow(unused_variables)] extern crate stackvec; use ::stackvec::prelude::*; fn main () { // An array of vectors (potentially expensive to clone) let vecs_array = [ vec![1, 2, 3, 4], vec![], vec![5, 6], ]; // Collect / chain all the vectors together let flattened: Vec<u8> = vecs_array .into_iter() .flatten() .collect() ; assert_eq!(flattened, vec![1, 2, 3, 4, 5, 6]); }
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::PPTIMER { #[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() -> u32 { 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 SYSCTL_PPTIMER_P0R { bits: bool, } impl SYSCTL_PPTIMER_P0R { #[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 _SYSCTL_PPTIMER_P0W<'a> { w: &'a mut W, } impl<'a> _SYSCTL_PPTIMER_P0W<'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 u32) & 1) << 0; self.w } } #[doc = r"Value of the field"] pub struct SYSCTL_PPTIMER_P1R { bits: bool, } impl SYSCTL_PPTIMER_P1R { #[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 _SYSCTL_PPTIMER_P1W<'a> { w: &'a mut W, } impl<'a> _SYSCTL_PPTIMER_P1W<'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 u32) & 1) << 1; self.w } } #[doc = r"Value of the field"] pub struct SYSCTL_PPTIMER_P2R { bits: bool, } impl SYSCTL_PPTIMER_P2R { #[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 _SYSCTL_PPTIMER_P2W<'a> { w: &'a mut W, } impl<'a> _SYSCTL_PPTIMER_P2W<'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 u32) & 1) << 2; self.w } } #[doc = r"Value of the field"] pub struct SYSCTL_PPTIMER_P3R { bits: bool, } impl SYSCTL_PPTIMER_P3R { #[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 _SYSCTL_PPTIMER_P3W<'a> { w: &'a mut W, } impl<'a> _SYSCTL_PPTIMER_P3W<'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 u32) & 1) << 3; self.w } } #[doc = r"Value of the field"] pub struct SYSCTL_PPTIMER_P4R { bits: bool, } impl SYSCTL_PPTIMER_P4R { #[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 _SYSCTL_PPTIMER_P4W<'a> { w: &'a mut W, } impl<'a> _SYSCTL_PPTIMER_P4W<'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 << 4); self.w.bits |= ((value as u32) & 1) << 4; self.w } } #[doc = r"Value of the field"] pub struct SYSCTL_PPTIMER_P5R { bits: bool, } impl SYSCTL_PPTIMER_P5R { #[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 _SYSCTL_PPTIMER_P5W<'a> { w: &'a mut W, } impl<'a> _SYSCTL_PPTIMER_P5W<'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 << 5); self.w.bits |= ((value as u32) & 1) << 5; self.w } } #[doc = r"Value of the field"] pub struct SYSCTL_PPTIMER_P6R { bits: bool, } impl SYSCTL_PPTIMER_P6R { #[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 _SYSCTL_PPTIMER_P6W<'a> { w: &'a mut W, } impl<'a> _SYSCTL_PPTIMER_P6W<'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 << 6); self.w.bits |= ((value as u32) & 1) << 6; self.w } } #[doc = r"Value of the field"] pub struct SYSCTL_PPTIMER_P7R { bits: bool, } impl SYSCTL_PPTIMER_P7R { #[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 _SYSCTL_PPTIMER_P7W<'a> { w: &'a mut W, } impl<'a> _SYSCTL_PPTIMER_P7W<'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 << 7); self.w.bits |= ((value as u32) & 1) << 7; self.w } } impl R { #[doc = r"Value of the register as raw bits"] #[inline(always)] pub fn bits(&self) -> u32 { self.bits } #[doc = "Bit 0 - 16/32-Bit General-Purpose Timer 0 Present"] #[inline(always)] pub fn sysctl_pptimer_p0(&self) -> SYSCTL_PPTIMER_P0R { let bits = ((self.bits >> 0) & 1) != 0; SYSCTL_PPTIMER_P0R { bits } } #[doc = "Bit 1 - 16/32-Bit General-Purpose Timer 1 Present"] #[inline(always)] pub fn sysctl_pptimer_p1(&self) -> SYSCTL_PPTIMER_P1R { let bits = ((self.bits >> 1) & 1) != 0; SYSCTL_PPTIMER_P1R { bits } } #[doc = "Bit 2 - 16/32-Bit General-Purpose Timer 2 Present"] #[inline(always)] pub fn sysctl_pptimer_p2(&self) -> SYSCTL_PPTIMER_P2R { let bits = ((self.bits >> 2) & 1) != 0; SYSCTL_PPTIMER_P2R { bits } } #[doc = "Bit 3 - 16/32-Bit General-Purpose Timer 3 Present"] #[inline(always)] pub fn sysctl_pptimer_p3(&self) -> SYSCTL_PPTIMER_P3R { let bits = ((self.bits >> 3) & 1) != 0; SYSCTL_PPTIMER_P3R { bits } } #[doc = "Bit 4 - 16/32-Bit General-Purpose Timer 4 Present"] #[inline(always)] pub fn sysctl_pptimer_p4(&self) -> SYSCTL_PPTIMER_P4R { let bits = ((self.bits >> 4) & 1) != 0; SYSCTL_PPTIMER_P4R { bits } } #[doc = "Bit 5 - 16/32-Bit General-Purpose Timer 5 Present"] #[inline(always)] pub fn sysctl_pptimer_p5(&self) -> SYSCTL_PPTIMER_P5R { let bits = ((self.bits >> 5) & 1) != 0; SYSCTL_PPTIMER_P5R { bits } } #[doc = "Bit 6 - 16/32-Bit General-Purpose Timer 6 Present"] #[inline(always)] pub fn sysctl_pptimer_p6(&self) -> SYSCTL_PPTIMER_P6R { let bits = ((self.bits >> 6) & 1) != 0; SYSCTL_PPTIMER_P6R { bits } } #[doc = "Bit 7 - 16/32-Bit General-Purpose Timer 7 Present"] #[inline(always)] pub fn sysctl_pptimer_p7(&self) -> SYSCTL_PPTIMER_P7R { let bits = ((self.bits >> 7) & 1) != 0; SYSCTL_PPTIMER_P7R { bits } } } impl W { #[doc = r"Writes raw bits to the register"] #[inline(always)] pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { self.bits = bits; self } #[doc = "Bit 0 - 16/32-Bit General-Purpose Timer 0 Present"] #[inline(always)] pub fn sysctl_pptimer_p0(&mut self) -> _SYSCTL_PPTIMER_P0W { _SYSCTL_PPTIMER_P0W { w: self } } #[doc = "Bit 1 - 16/32-Bit General-Purpose Timer 1 Present"] #[inline(always)] pub fn sysctl_pptimer_p1(&mut self) -> _SYSCTL_PPTIMER_P1W { _SYSCTL_PPTIMER_P1W { w: self } } #[doc = "Bit 2 - 16/32-Bit General-Purpose Timer 2 Present"] #[inline(always)] pub fn sysctl_pptimer_p2(&mut self) -> _SYSCTL_PPTIMER_P2W { _SYSCTL_PPTIMER_P2W { w: self } } #[doc = "Bit 3 - 16/32-Bit General-Purpose Timer 3 Present"] #[inline(always)] pub fn sysctl_pptimer_p3(&mut self) -> _SYSCTL_PPTIMER_P3W { _SYSCTL_PPTIMER_P3W { w: self } } #[doc = "Bit 4 - 16/32-Bit General-Purpose Timer 4 Present"] #[inline(always)] pub fn sysctl_pptimer_p4(&mut self) -> _SYSCTL_PPTIMER_P4W { _SYSCTL_PPTIMER_P4W { w: self } } #[doc = "Bit 5 - 16/32-Bit General-Purpose Timer 5 Present"] #[inline(always)] pub fn sysctl_pptimer_p5(&mut self) -> _SYSCTL_PPTIMER_P5W { _SYSCTL_PPTIMER_P5W { w: self } } #[doc = "Bit 6 - 16/32-Bit General-Purpose Timer 6 Present"] #[inline(always)] pub fn sysctl_pptimer_p6(&mut self) -> _SYSCTL_PPTIMER_P6W { _SYSCTL_PPTIMER_P6W { w: self } } #[doc = "Bit 7 - 16/32-Bit General-Purpose Timer 7 Present"] #[inline(always)] pub fn sysctl_pptimer_p7(&mut self) -> _SYSCTL_PPTIMER_P7W { _SYSCTL_PPTIMER_P7W { w: self } } }
#[cfg(feature = "parallel")] extern crate rayon; #[macro_use] extern crate lazy_static; extern crate typid; #[macro_use] extern crate pest_derive; #[macro_use] pub mod log; pub mod app; pub mod assets; pub mod error; pub mod fetch; pub mod hierarchy; pub mod prefab; pub mod state; #[macro_use] pub mod localization; pub mod storage; #[cfg(test)] mod tests; pub mod id { pub use typid::*; } pub mod ecs { pub use shred::Resource; pub use shrev::*; pub use specs::*; } pub mod ignite { pub use oxygengine_ignite_types as types; } pub mod prelude { pub use crate::{ app::*, assets::prelude::*, ecs::*, fetch::prelude::*, fetch::*, hierarchy::*, id::*, localization::*, log::*, prefab::*, state::*, storage::prelude::*, storage::*, Ignite, Scalar, }; } #[cfg(feature = "scalar64")] pub type Scalar = f64; #[cfg(not(feature = "scalar64"))] pub type Scalar = f32; pub use oxygengine_ignite_derive::{ignite_proxy, Ignite};
macro_rules! make_prop_enum_type { ($prop: ident, $propname: expr, $default: ident, $($ty: ident => $jprop: expr),*) => { #[derive(Copy, Clone, PartialEq, Debug)] pub enum $prop { $($ty,)* } impl Default for $prop { fn default() -> $prop { $prop::$default } } impl ToString for $prop { fn to_string(&self) -> String { match *self { $($prop::$ty => $jprop,)* }.to_string() } } impl ToJson for $prop { fn to_json(&self) -> Json { Json::String(self.to_string()) } } impl FromJson for $prop { fn from_json(json: &Json) -> Result<$prop,ParseError> { match *json { Json::String(ref v) => match v.as_ref() { $($jprop => Ok($prop::$ty),)* _ => Err(ParseError::InvalidStructure($propname.to_string())), }, _ => Err(ParseError::InvalidJsonType($propname.to_string())), } } } } } macro_rules! make_prop_type { ($prop: ident, $propname: expr, $($field: ident: $ty: ty => $jprop: expr),*) => { #[derive(Clone, PartialEq, Debug)] pub struct $prop { $($field: $ty,)* } impl Default for $prop { fn default() -> $prop { $prop { $($field: Default::default()),* } } } impl ToJson for $prop { fn to_json(&self) -> Json { let mut d = BTreeMap::<String,Json>::new(); $(self.$field.to_json_field(&mut d, $jprop);)* Json::Object(d) } } impl FromJson for $prop { fn from_json(json: &Json) -> Result<$prop,ParseError> { match *json { Json::Object(ref o) => { let mut prop = $prop::default(); $(prop.$field = try!(FromJsonField::from_json_field(o, $jprop));)* Ok(prop) }, _ => Err(ParseError::InvalidJsonType($propname.to_string())), } } } } } macro_rules! make_record_type { ($record: ident, $partialrecord: ident, $recname: expr, $($field: ident: $ty: ty => $jprop: expr),*) => { #[derive(Clone, PartialEq, Debug)] pub struct $record { id: String, $($field: $ty),* } impl Default for $record { fn default() -> $record { $record { id: record::new_id(), $($field: Default::default()),* } } } impl ToJson for $record { fn to_json(&self) -> Json { let mut d = BTreeMap::<String,Json>::new(); self.id.to_json_field(&mut d, "id"); $(self.$field.to_json_field(&mut d, $jprop);)* Json::Object(d) } } impl FromJson for $record { fn from_json(json: &Json) -> Result<$record,ParseError> { match *json { Json::Object(ref o) => { let mut r = $record::default(); r.id = try!(FromJsonField::from_json_field(o, "id")); $(r.$field = try!(FromJsonField::from_json_field(o, $jprop));)* Ok(r) } _ => Err(ParseError::InvalidJsonType($recname.to_string())), } } } #[derive(Clone, PartialEq, Debug)] pub struct $partialrecord { id: Presence<String>, $($field: Presence<$ty>),* } impl PartialRecord for $partialrecord { fn id(&self) -> Presence<String> { self.id.clone() } } impl Default for $partialrecord { fn default() -> $partialrecord { $partialrecord { id: Absent, $($field: Absent),* } } } impl ToJson for $partialrecord { fn to_json(&self) -> Json { let mut d = BTreeMap::<String,Json>::new(); self.id.to_json_field(&mut d, "id"); $(self.$field.to_json_field(&mut d, $jprop);)* Json::Object(d) } } impl FromJson for $partialrecord { fn from_json(json: &Json) -> Result<$partialrecord,ParseError> { match *json { Json::Object(ref o) => { let mut r = $partialrecord::default(); r.id = try!(FromJsonField::from_json_field(o, "id")); $(r.$field = try!(FromJsonField::from_json_field(o, $jprop));)* Ok(r) } _ => Err(ParseError::InvalidJsonType($recname.to_string())), } } } impl Record for $record { type Partial = $partialrecord; fn id(&self) -> String { self.id.clone() } fn updated_with(&self, p: &$partialrecord) -> $record { let mut r = self.clone(); let u = p.clone(); if let Present(v) = u.id { r.id = v }; $(if let Present(v) = u.$field { r.$field = v };)* r } fn to_partial(&self) -> $partialrecord { $partialrecord { id: Present(self.id.clone()), $($field: Present(self.$field.clone()),)* } } fn to_filtered_partial(&self, properties: &Vec<String>) -> $partialrecord { let mut p = $partialrecord::default(); p.id = Present(self.id.clone()); for prop in properties.iter() { match prop.as_ref() { $($jprop => p.$field = Present(self.$field.clone()),)* _ => () } } p } } } } macro_rules! make_method_args_type { ($args: ident, $argsname: expr, $($field: ident: $ty: ty => $jprop: expr),*) => { #[derive(Clone, PartialEq, Debug)] pub struct $args { $(pub $field: $ty),* } impl Default for $args { fn default() -> $args { $args { $($field: Default::default()),* } } } impl ToJson for $args { fn to_json(&self) -> Json { let mut d = BTreeMap::<String,Json>::new(); $(self.$field.to_json_field(&mut d, $jprop);)* Json::Object(d) } } impl FromJson for $args { fn from_json(json: &Json) -> Result<$args,ParseError> { match *json { Json::Object(ref o) => { let mut args = <$args>::default(); $(args.$field = try!(FromJsonField::from_json_field(o, $jprop));)* Ok(args) }, _ => Err(ParseError::InvalidJsonType($argsname.to_string())), } } } } } macro_rules! make_record_method_args_type { ($args: ident, $argsname: expr, $($field: ident: $ty: ty => $jprop: expr),*) => { #[derive(Clone, PartialEq, Debug)] pub struct $args<R> where R: Record { pub _marker: PhantomData<R>, $(pub $field: $ty),* } impl<R: Record> Default for $args<R> { fn default() -> $args<R> { $args::<R> { _marker: PhantomData, $($field: Default::default()),* } } } impl<R: Record> ToJson for $args<R> { fn to_json(&self) -> Json { let mut d = BTreeMap::<String,Json>::new(); $(self.$field.to_json_field(&mut d, $jprop);)* Json::Object(d) } } impl<R: Record> FromJson for $args<R> { fn from_json(json: &Json) -> Result<$args<R>,ParseError> { match *json { Json::Object(ref o) => { let mut args = <$args<R>>::default(); $(args.$field = try!(FromJsonField::from_json_field(o, $jprop));)* Ok(args) }, _ => Err(ParseError::InvalidJsonType($argsname.to_string())), } } } } } macro_rules! make_batch { ($batch: ident, $method: ty) => { #[derive(Clone, PartialEq, Debug)] pub struct $batch(pub Vec<$method>); impl Default for $batch { fn default() -> $batch { $batch(vec!()) } } impl ToJson for $batch { fn to_json(&self) -> Json { self.0.to_json() } } impl FromJson for $batch { fn from_json(json: &Json) -> Result<$batch,ParseError> { match Vec::<$method>::from_json(json) { Ok(v) => Ok($batch(v)), Err(e) => Err(e), } } } } } macro_rules! make_methods { ($set: ident, $setname: expr, $error: ident, $($method: ident, $args: ty => $methodname: expr),*) => { #[derive(Clone, PartialEq, Debug)] pub enum $set { $($method($args, String),)* } impl ToJson for $set { fn to_json(&self) -> Json { Json::Array( match *self { $($method(ref args, ref client_id) => vec!($methodname.to_json(), args.to_json(), client_id.to_json()),)* } ) } } impl FromJson for $set { fn from_json(json: &Json) -> Result<$set,ParseError> { match *json { Json::Array(ref a) => { if let false = a.len() == 3 { return Err(ParseError::InvalidStructure($setname.to_string())); } let method = try!(String::from_json(&a[0])); let client_id = try!(String::from_json(&a[2])); match method.as_ref() { $($methodname => Ok($method(try!(<$args>::from_json(&a[1])), client_id)),)* _ => Ok($error(MethodError::UnknownMethod(Present(ErrorDescription(method))), client_id)), } }, _ => Err(ParseError::InvalidJsonType($setname.to_string())), } } } impl ClientId for $set { fn client_id(&self) -> String { match *self { $($method(_, ref id) => id,)* }.clone() } } } }
#[derive(Debug)] enum UsState { Alabama, Alaska, // --snip-- } #[derive(Debug)] enum Coin { Penny, Nickel, Dime, Quarter(UsState), } fn main() { /* The if let syntax lets you combine if and let into a less verbose way to handle values that match one pattern while ignoring the rest. Consider this code that matches on an Option<u8> value but only wants to execute code if the value is 3. */ // let some_u8_value = Some(0u8); let some_u8_value = Some(3); match some_u8_value { Some(3) => println!("three"), _ => (), } // Instead, we could write this in a shorter way using if let. if let Some(3) = some_u8_value { println!("three"); } let coin = Coin::Quarter(UsState::Alaska); let mut count = 0; match coin { Coin::Quarter(state) => println!("State quarter from {:?}!", state), _ => count += 1, } println!("count is {}", count); let coin2 = Coin::Quarter(UsState::Alabama); let coin3 = Coin::Penny; let coin4 = Coin::Nickel; let coin5 = Coin::Dime; let mut count2 = 0; if let Coin::Quarter(state) = coin2 { println!("State quarter from {:?}!", state); } else { count2 += 1; } println!("count2 is {}", count2); println!("The values for coin3, coin4 and coin5 are: {:?}, {:?} and {:?}.", coin3, coin4, coin5) }
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use glib; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::GString; use glib_sys; use libc; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; use std::ptr; use webkit2_webextension_sys; use DOMCharacterData; use DOMEventTarget; use DOMNode; use DOMObject; glib_wrapper! { pub struct DOMText(Object<webkit2_webextension_sys::WebKitDOMText, webkit2_webextension_sys::WebKitDOMTextClass, DOMTextClass>) @extends DOMCharacterData, DOMNode, DOMObject, @implements DOMEventTarget; match fn { get_type => || webkit2_webextension_sys::webkit_dom_text_get_type(), } } pub const NONE_DOM_TEXT: Option<&DOMText> = None; pub trait DOMTextExt: 'static { #[cfg_attr(feature = "v2_22", deprecated)] fn get_whole_text(&self) -> Option<GString>; #[cfg_attr(feature = "v2_14", deprecated)] fn replace_whole_text(&self, content: &str) -> Result<DOMText, glib::Error>; #[cfg_attr(feature = "v2_22", deprecated)] fn split_text(&self, offset: libc::c_ulong) -> Result<DOMText, glib::Error>; fn connect_property_whole_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; } impl<O: IsA<DOMText>> DOMTextExt for O { fn get_whole_text(&self) -> Option<GString> { unsafe { from_glib_full(webkit2_webextension_sys::webkit_dom_text_get_whole_text( self.as_ref().to_glib_none().0, )) } } fn replace_whole_text(&self, content: &str) -> Result<DOMText, glib::Error> { unsafe { let mut error = ptr::null_mut(); let ret = webkit2_webextension_sys::webkit_dom_text_replace_whole_text( self.as_ref().to_glib_none().0, content.to_glib_none().0, &mut error, ); if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } } } fn split_text(&self, offset: libc::c_ulong) -> Result<DOMText, glib::Error> { unsafe { let mut error = ptr::null_mut(); let ret = webkit2_webextension_sys::webkit_dom_text_split_text( self.as_ref().to_glib_none().0, offset, &mut error, ); if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } } } fn connect_property_whole_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_whole_text_trampoline<P, F: Fn(&P) + 'static>( this: *mut webkit2_webextension_sys::WebKitDOMText, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<DOMText>, { let f: &F = &*(f as *const F); f(&DOMText::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::whole-text\0".as_ptr() as *const _, Some(transmute(notify_whole_text_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } } impl fmt::Display for DOMText { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "DOMText") } }
use sea_orm::entity::prelude::*; #[derive(Copy, Clone, Default, Debug, DeriveEntity)] pub struct Entity; impl EntityName for Entity { fn table_name(&self) -> &str { "seaql_migrations" } } #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel)] pub struct Model { pub version: String, pub applied_at: i64, } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] pub enum Column { Version, AppliedAt, } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] pub enum PrimaryKey { Version, } impl PrimaryKeyTrait for PrimaryKey { type ValueType = String; fn auto_increment() -> bool { false } } #[derive(Copy, Clone, Debug, EnumIter)] pub enum Relation {} impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { Self::Version => ColumnType::String(None).def(), Self::AppliedAt => ColumnType::BigInteger.def(), } } } impl RelationTrait for Relation { fn def(&self) -> RelationDef { panic!("No RelationDef") } } impl ActiveModelBehavior for ActiveModel {}
use super::field::{One, Zero}; use std::ops::{Add, BitAnd, Div, Mul, Shr, Sub}; pub trait IntoBit { fn into_bit(self) -> Vec<BitWrapper>; } impl<T> IntoBit for T where T: Sized + One + Zero + BitAnd<Output = T> + Shr<usize, Output = T> + PartialEq + Clone, { fn into_bit(self) -> Vec<BitWrapper> { let mut n = self; let mut vec = vec![]; while { vec.push(BitWrapper(if n.clone() & T::one() == T::one() { true } else { false })); n = n >> 1; n != T::zero() } {} vec } } #[derive(Debug, PartialEq, Copy, Clone, Eq)] pub struct BitWrapper(bool); impl One for BitWrapper { fn one() -> Self { BitWrapper(true) } } impl Zero for BitWrapper { fn zero() -> Self { BitWrapper(false) } } impl From<BitWrapper> for bool { fn from(bit: BitWrapper) -> Self { let BitWrapper(b) = bit; b } } impl Add for BitWrapper { type Output = Self; fn add(self, rhs: Self) -> Self::Output { BitWrapper(self.0 ^ rhs.0) } } impl Sub for BitWrapper { type Output = Self; fn sub(self, rhs: Self) -> Self::Output { BitWrapper(self.0 ^ rhs.0) } } impl Mul for BitWrapper { type Output = Self; fn mul(self, rhs: Self) -> Self::Output { BitWrapper(self.0 & rhs.0) } } impl Div for BitWrapper { type Output = Self; fn div(self, rhs: Self) -> Self::Output { assert_ne!(self, Self::zero()); BitWrapper(self.0 & rhs.0) } }
#[derive(Debug, PartialEq)] struct City<'a> { name: &'a str, population: i64, country: &'a str, } impl<'a> City<'a> { fn new(name: &'a str, population: i64, country: &'a str) -> City<'a> { City { name, population, country, } } } fn sort_cities(cities: &mut Vec<City>) { cities.sort_by_key(|city| -city.population) } fn count_selected_cities<F>(cities: &Vec<City>, test_fn: F) -> usize where F: Fn(&City) -> bool, { let mut count = 0; for city in cities { if test_fn(city) { count += 1; } } count } fn belongs_to_country(country: String) -> impl Fn(&City) -> bool { move |city| city.country.to_lowercase() == country.to_lowercase() } #[test] fn should_sort_by_key() { let city2 = City::new("Toro", 9000, "Spain"); let city1 = City::new("Madrid", 7000000, "Spain"); let mut cities = vec![city1, city2]; sort_cities(&mut cities); assert_eq!( &cities, &vec![ City::new("Madrid", 7000000, "Spain"), City::new("Toro", 9000, "Spain") ] ); } #[test] fn closures_test() { let cities = vec![ City::new("Vergen", 450000, "Stonk"), City::new("Slujhan", 600000, "Tiranthia"), ]; let limit = 500000; let total_cities = count_selected_cities(&cities, |city| city.population > limit); let end_with_cities = count_selected_cities(&cities, |city| city.name.ends_with("n")); let country = String::from("stonk"); let belongs_func = belongs_to_country(country); let cities_belong_to = count_selected_cities(&cities, belongs_func); assert_eq!(total_cities, 1); assert_eq!(end_with_cities, 2); assert_eq!(cities_belong_to, 1); }
// Shortest Path in Binary Matrix // https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3638/ pub struct Solution; use std::collections::BinaryHeap; #[derive(Eq)] struct Candidate { pub len: i32, pub r: usize, pub c: usize, } impl PartialEq for Candidate { fn eq(&self, other: &Self) -> bool { self.len == other.len } } impl PartialOrd for Candidate { fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { Some(other.len.cmp(&self.len)) } } impl Ord for Candidate { fn cmp(&self, other: &Self) -> std::cmp::Ordering { other.len.cmp(&self.len) } } impl Solution { pub fn shortest_path_binary_matrix(mut grid: Vec<Vec<i32>>) -> i32 { let h = grid.len(); let w = grid[0].len(); let mut cands = BinaryHeap::new(); if grid[0][0] == 0 { grid[0][0] = 1; cands.push(Candidate { len: 1, r: 0, c: 0 }); } while let Some(cand) = cands.pop() { if cand.r == h - 1 && cand.c == w - 1 { return cand.len; } for r in (cand.r.max(1) - 1)..=(cand.r + 1).min(h - 1) { for c in (cand.c.max(1) - 1)..=(cand.c + 1).min(w - 1) { if grid[r][c] == 0 { grid[r][c] = 1; cands.push(Candidate { len: cand.len + 1, r, c, }); } } } } -1 } } #[cfg(test)] mod tests { use super::*; use crate::matrix; #[test] fn example1() { assert_eq!( Solution::shortest_path_binary_matrix(matrix![[0, 1], [1, 0]]), 2, ); } #[test] fn example2() { assert_eq!( Solution::shortest_path_binary_matrix(matrix![ [0, 0, 0], [1, 1, 0], [1, 1, 0], ]), 4, ); } #[test] fn test_blocked() { assert_eq!( Solution::shortest_path_binary_matrix(matrix![ [0, 1, 1], [1, 1, 1], [1, 1, 0], ]), -1, ); } #[test] fn fail1() { assert_eq!( Solution::shortest_path_binary_matrix(matrix![ [1, 0, 0], [1, 1, 0], [1, 1, 0], ]), -1, ); } #[test] fn fail2() { assert_eq!(Solution::shortest_path_binary_matrix(matrix![[0]]), 1); } #[test] fn test_big() { assert_eq!( Solution::shortest_path_binary_matrix(matrix![0; 100; 100]), 100, ); } }
use std::fmt; use std::fmt::{Debug, Formatter}; use libusb::{DeviceHandle, Result, TransferType}; use crate::devices::device_info::DeviceInfo; use crate::devices::endpoints::Endpoints; use crate::devices::identifier::Identifier; use std::time::Duration; pub struct Controller<'a> { pub identifier: &'static Identifier, pub device_info: DeviceInfo, handle: DeviceHandle<'a>, endpoints: Endpoints, } impl<'a> Controller<'a> { pub(super) fn new( identifier: &'static Identifier, device_info: DeviceInfo, handle: DeviceHandle<'a>, endpoints: Endpoints, ) -> Controller<'a> { Controller { identifier, device_info, handle, endpoints, } } pub fn prepare(&mut self) -> Result<()> { let endpoint = &self.endpoints[&TransferType::Interrupt]; self.handle.reset()?; if self.handle.kernel_driver_active(endpoint.interface)? { println!("Detaching kernel driver"); self.handle.detach_kernel_driver(endpoint.interface)?; } self.handle.set_active_configuration(endpoint.config)?; self.handle.claim_interface(endpoint.interface)?; self.handle .set_alternate_setting(endpoint.interface, endpoint.setting)?; Ok(()) } pub fn read(&self) -> Result<Vec<u8>> { let endpoint = &self.endpoints[&TransferType::Interrupt]; let mut buffer = [0u8; 64]; let read = self.handle .read_interrupt(endpoint.input, &mut buffer, Duration::from_secs(1))?; Ok(buffer[0..read].to_vec()) } pub fn write(&self, data: &[u8]) -> Result<()> { let endpoint = &self.endpoints[&TransferType::Interrupt]; self.handle .write_interrupt(endpoint.output, data, Duration::from_secs(0))?; Ok(()) } } impl Debug for Controller<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.debug_struct("Controller") .field( "identifier", &format!( "{:04x}:{:04x}", self.identifier.vendor_id, self.identifier.product_id ), ) .field("device_info", &self.device_info) .field("endpoints", &self.endpoints) .finish() } }
// 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. //! Defines a C API to spawn a cloud provider factory on a testloop, //! so that it can be exposed to Ledger integration tests. use cloud_provider_memory_diff_lib::CloudControllerFactory; use fidl::endpoints::RequestStream; use fidl_fuchsia_ledger_cloud_test::CloudControllerFactoryRequestStream; use fuchsia_async as fasync; use fuchsia_async_testloop::async_test_subloop_t; use fuchsia_zircon::{self as zx, HandleBased}; use fuchsia_zircon_sys::zx_handle_t; #[no_mangle] /// Creates a subloop running a `CloudControllerFactory` answering on the given channel. extern "C" fn cloud_provider_memory_diff_new_cloud_controller_factory( channel: zx_handle_t, ) -> *mut async_test_subloop_t { let fut = async move { let handle = unsafe { zx::Handle::from_raw(channel) }; let channel = fasync::Channel::from_channel(zx::Channel::from_handle(handle)).unwrap(); let stream = CloudControllerFactoryRequestStream::from_channel(channel); CloudControllerFactory::new(stream).run().await }; fuchsia_async_testloop::new_subloop(fut) }
use crate::{DocBase, VarType}; const DESCRIPTION: &'static str = r#" Function timestamp returns UNIX time of specified date and time. "#; const EXAMPLE: &'static str = r#" ```pine //@version=4 study("My Script") plot(timestamp(2016, 01, 19, 09, 30), linewidth=3, color=color.green) plot(timestamp(syminfo.timezone, 2016, 01, 19, 09, 30), color=color.blue) plot(timestamp(2016, 01, 19, 09, 30), color=color.yellow) plot(timestamp("GMT+6", 2016, 01, 19, 09, 30)) plot(timestamp(2019, 06, 19, 09, 30, 15), color=color.lime) plot(timestamp("GMT+3", 2019, 06, 19, 09, 30, 15), color=color.fuchsia) ``` "#; const ARGUMENT: &'static str = r#" **timezone (string)** (Optional argument) Timezone **year (int)** Year **month (int)** Month **day (int)** Day **hour (int)** Hour **minute (int)** Minute **second (int)** (Optional argument) Second. Default is 0. "#; const REMARKS: &'static str = r#" UNIX time is the number of milliseconds that have elapsed since 00:00:00 UTC, 1 January 1970. By default Timezone is [syminfo.timezone](#var-syminfo-timezone), but it can be specified by GMT-notation (e.g "GMT-5", "GMT+5", "GMT+5:30", etc), or one of following values: "America/New_York" "America/Los_Angeles" "America/Chicago" "America/Phoenix" "America/Toronto" "America/Vancouver" "America/Argentina/Buenos_Aires" "America/El_Salvador" "America/Sao_Paulo" "America/Bogota" "Europe/Moscow" "Europe/Athens" "Europe/Berlin" "Europe/London" "Europe/Madrid" "Europe/Paris" "Europe/Warsaw" "Australia/Sydney" "Australia/Brisbane" "Australia/Adelaide" "Australia/ACT" "Asia/Almaty" "Asia/Ashkhabad" "Asia/Tokyo" "Asia/Taipei" "Asia/Singapore" "Asia/Shanghai" "Asia/Seoul" "Asia/Tehran" "Asia/Dubai" "Asia/Kolkata" "Asia/Hong_Kong" "Asia/Bangkok" "Pacific/Auckland" "Pacific/Chatham" "Pacific/Fakaofo" "Pacific/Honolulu" "#; pub fn gen_doc() -> Vec<DocBase> { let fn_doc = DocBase { var_type: VarType::Function, name: "timestamp", signatures: vec![], description: DESCRIPTION, example: EXAMPLE, returns: "UNIX time.", arguments: ARGUMENT, remarks: REMARKS, links: "[time](#fun-time)", }; vec![fn_doc] }
/* * @lc app=leetcode.cn id=10 lang=rust * * [10] 正则表达式匹配 * * https://leetcode-cn.com/problems/regular-expression-matching/description/ * * algorithms * Hard (21.47%) * Total Accepted: 11.3K * Total Submissions: 52.4K * Testcase Example: '"aa"\n"a"' * * 给定一个字符串 (s) 和一个字符模式 (p)。实现支持 '.' 和 '*' 的正则表达式匹配。 * * '.' 匹配任意单个字符。 * '*' 匹配零个或多个前面的元素。 * * * 匹配应该覆盖整个字符串 (s) ,而不是部分字符串。 * * 说明: * * * s 可能为空,且只包含从 a-z 的小写字母。 * p 可能为空,且只包含从 a-z 的小写字母,以及字符 . 和 *。 * * * 示例 1: * * 输入: * s = "aa" * p = "a" * 输出: false * 解释: "a" 无法匹配 "aa" 整个字符串。 * * * 示例 2: * * 输入: * s = "aa" * p = "a*" * 输出: true * 解释: '*' 代表可匹配零个或多个前面的元素, 即可以匹配 'a' 。因此, 重复 'a' 一次, 字符串可变为 "aa"。 * * * 示例 3: * * 输入: * s = "ab" * p = ".*" * 输出: true * 解释: ".*" 表示可匹配零个或多个('*')任意字符('.')。 * * * 示例 4: * * 输入: * s = "aab" * p = "c*a*b" * 输出: true * 解释: 'c' 可以不被重复, 'a' 可以被重复一次。因此可以匹配字符串 "aab"。 * * * 示例 5: * * 输入: * s = "mississippi" * p = "mis*is*p*." * 输出: false * */ /// /// dp[i][j] 表示 字符串 s 的 前i字符能否被pattern的前j个匹配 /// dp[0][0] = true /// dp[i][j] = dp[i-1][j-1] && match(s[i],p[j]) || dp[i-1][j]&& p[j]==* /// impl Solution { pub fn is_match(s: String, p: String) -> bool { let s = s.as_bytes(); let p = p.as_bytes(); let mut dp = vec![vec![false; p.len() + 1]; s.len() + 1]; dp[0][0] = true; for j in (2..=p.len()).step_by(2) { dp[0][j] = dp[0][j - 2] && p[j - 1] == b'*'; } for i in 1..=s.len() { for j in 1..=p.len() { dp[i][j] = match p[j - 1] { b'*' => { dp[i][j - 2] // * 可以匹配0个 || dp[i][j - 1] // 可以匹配一个 || ((dp[i - 1][j - 1] || dp[i - 1][j]) && (p[j - 2] == s[i - 1] || p[j - 2] == b'.')) // 匹配多个 } b'.' => dp[i - 1][j - 1], _ => dp[i - 1][j - 1] && s[i - 1] == p[j - 1], }; } } dp[s.len()][p.len()] } } struct Solution {} fn main() { let s = "aaa".to_string(); let p = "ab*a*c*a".to_string(); let res = Solution::is_match(s, p); assert_eq!(true, res); let s = "mississippi".to_string(); let p = "mis*is*p*.".to_string(); let res = Solution::is_match(s, p); assert_eq!(false, res); let s = "aab".to_string(); let p = "c*a*b".to_string(); let res = Solution::is_match(s, p); assert_eq!(true, res); let s = "aaa".to_string(); let p = "a*".to_string(); let res = Solution::is_match(s, p); assert_eq!(true, res); let s = "aa".to_string(); let p = "a*".to_string(); let res = Solution::is_match(s, p); assert_eq!(true, res); let s = "aa".to_string(); let p = "a".to_string(); let res = Solution::is_match(s, p); assert_eq!(false, res); let s = "".to_string(); let p = "a*".to_string(); let res = Solution::is_match(s, p); assert_eq!(true, res); }
// Note: The following file is largely derived from the fixedbitset // crate, (crates.io/crates/fixedbitset) of which I have copied the // license (MIT) below: // // Copyright (c) 2015-2017 // // 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. use std::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign}; const BITS: usize = 64; type Block = u64; #[inline(always)] #[no_coverage] fn div_rem(x: usize, d: usize) -> (usize, usize) { (x / d, x % d) } /// `FixedBitSet` is a simple fixed size set of bits that each can /// be enabled (1 / **true**) or disabled (0 / **false**). /// /// The bit set has a fixed capacity in terms of enabling bits (and the /// capacity can grow using the `grow` method). #[derive(Clone, Debug, Default)] pub struct FixedBitSet { data: Vec<Block>, /// length in bits length: usize, } impl FixedBitSet { /// Create a new empty **FixedBitSet**. #[no_coverage] pub const fn new() -> Self { FixedBitSet { data: Vec::new(), length: 0, } } /// Create a new **FixedBitSet** with a specific number of bits, /// all initially clear. #[no_coverage] pub fn with_capacity(bits: usize) -> Self { let (mut blocks, rem) = div_rem(bits, BITS); blocks += (rem > 0) as usize; FixedBitSet { data: vec![0; blocks], length: bits, } } /// Grow capacity to **bits**, all new bits initialized to zero #[no_coverage] pub fn grow(&mut self, bits: usize) { if bits > self.length { let (mut blocks, rem) = div_rem(bits, BITS); blocks += (rem > 0) as usize; self.length = bits; self.data.resize(blocks, 0); } } /// Return the length of the [`FixedBitSet`] in bits. #[inline] #[no_coverage] pub fn len(&self) -> usize { self.length } /// Return if the [`FixedBitSet`] is empty. #[inline] #[no_coverage] pub fn is_empty(&self) -> bool { self.len() == 0 } /// Return **true** if the bit is enabled in the **FixedBitSet**, /// **false** otherwise. /// /// Note: bits outside the capacity are always disabled. /// /// Note: Also available with index syntax: `bitset[bit]`. #[inline] #[no_coverage] pub fn contains(&self, bit: usize) -> bool { let (block, i) = div_rem(bit, BITS); match self.data.get(block) { None => false, Some(b) => (b & (1 << i)) != 0, } } /// Clear all bits. #[inline] #[no_coverage] pub fn clear(&mut self) { for elt in &mut self.data { *elt = 0 } } /// Enable `bit`. /// /// **Panics** if **bit** is out of bounds. #[inline(always)] #[no_coverage] pub fn insert(&mut self, bit: usize) { assert!( bit < self.length, "insert at index {} exceeds fixbitset size {}", bit, self.length ); let (block, i) = div_rem(bit, BITS); unsafe { *self.data.get_unchecked_mut(block) |= 1 << i; } } /// Enable `bit`, and return its previous value. /// /// **Panics** if **bit** is out of bounds. #[inline] #[no_coverage] pub fn put(&mut self, bit: usize) -> bool { assert!( bit < self.length, "put at index {} exceeds fixbitset size {}", bit, self.length ); let (block, i) = div_rem(bit, BITS); unsafe { let word = self.data.get_unchecked_mut(block); let prev = *word & (1 << i) != 0; *word |= 1 << i; prev } } /// Toggle `bit` (inverting its state). /// /// ***Panics*** if **bit** is out of bounds #[inline] #[no_coverage] pub fn toggle(&mut self, bit: usize) { assert!( bit < self.length, "toggle at index {} exceeds fixbitset size {}", bit, self.length ); let (block, i) = div_rem(bit, BITS); unsafe { *self.data.get_unchecked_mut(block) ^= 1 << i; } } /// Count the number of set bits in the given bit range. /// /// Use `..` to count the whole content of the bitset. /// /// **Panics** if the range extends past the end of the bitset. #[inline] #[no_coverage] pub fn count_ones(&self) -> usize { let mut sum = 0; for block in &self.data { sum += block.count_ones(); } sum as usize } /// Iterates over all enabled bits. /// /// Iterator element is the index of the `1` bit, type `usize`. #[inline] #[no_coverage] pub fn ones(&self) -> Ones { match self.as_slice().split_first() { Some((&block, rem)) => Ones { bitset: block, block_idx: 0, remaining_blocks: rem, }, None => Ones { bitset: 0, block_idx: 0, remaining_blocks: &[], }, } } /// View the bitset as a slice of `u64` blocks #[inline] #[no_coverage] pub fn as_slice(&self) -> &[u64] { &self.data } /// In-place union of two `FixedBitSet`s. /// /// On calling this method, `self`'s capacity may be increased to match `other`'s. #[no_coverage] pub fn union_with(&mut self, other: &FixedBitSet) { if other.len() >= self.len() { self.grow(other.len()); } for (x, y) in self.data.iter_mut().zip(other.data.iter()) { *x |= *y; } } /// In-place intersection of two `FixedBitSet`s. /// /// On calling this method, `self`'s capacity will remain the same as before. #[no_coverage] pub fn intersect_with(&mut self, other: &FixedBitSet) { for (x, y) in self.data.iter_mut().zip(other.data.iter()) { *x &= *y; } let mn = std::cmp::min(self.data.len(), other.data.len()); for wd in &mut self.data[mn..] { *wd = 0; } } /// In-place difference of two `FixedBitSet`s. /// /// On calling this method, `self`'s capacity will remain the same as before. #[no_coverage] pub fn difference_with(&mut self, other: &FixedBitSet) { for (x, y) in self.data.iter_mut().zip(other.data.iter()) { *x &= !*y; } // There's no need to grow self or do any other adjustments. // // * If self is longer than other, the bits at the end of self won't be affected since other // has them implicitly set to 0. // * If other is longer than self, the bits at the end of other are irrelevant since self // has them set to 0 anyway. } /// In-place symmetric difference of two `FixedBitSet`s. /// /// On calling this method, `self`'s capacity may be increased to match `other`'s. #[no_coverage] pub fn symmetric_difference_with(&mut self, other: &FixedBitSet) { if other.len() >= self.len() { self.grow(other.len()); } for (x, y) in self.data.iter_mut().zip(other.data.iter()) { *x ^= *y; } } } /// An iterator producing the indices of the set bit in a set. /// /// This struct is created by the [`FixedBitSet::ones`] method. pub struct Ones<'a> { bitset: Block, block_idx: usize, remaining_blocks: &'a [Block], } impl<'a> Iterator for Ones<'a> { type Item = usize; // the bit position of the '1' #[inline] #[no_coverage] fn next(&mut self) -> Option<Self::Item> { while self.bitset == 0 { if self.remaining_blocks.is_empty() { return None; } self.bitset = self.remaining_blocks[0]; self.remaining_blocks = &self.remaining_blocks[1..]; self.block_idx += 1; } #[allow(clippy::unnecessary_cast)] let t = self.bitset & (0 as Block).wrapping_sub(self.bitset); let r = self.bitset.trailing_zeros() as usize; self.bitset ^= t; Some(self.block_idx * BITS + r) } } impl<'a> BitAnd for &'a FixedBitSet { type Output = FixedBitSet; #[no_coverage] fn bitand(self, other: &FixedBitSet) -> FixedBitSet { let (short, long) = { if self.len() <= other.len() { (&self.data, &other.data) } else { (&other.data, &self.data) } }; let mut data = short.clone(); for (data, block) in data.iter_mut().zip(long.iter()) { *data &= *block; } let len = std::cmp::min(self.len(), other.len()); FixedBitSet { data, length: len } } } impl BitAndAssign for FixedBitSet { #[no_coverage] fn bitand_assign(&mut self, other: Self) { self.intersect_with(&other); } } impl BitAndAssign<&Self> for FixedBitSet { #[no_coverage] fn bitand_assign(&mut self, other: &Self) { self.intersect_with(other); } } impl<'a> BitOr for &'a FixedBitSet { type Output = FixedBitSet; #[no_coverage] fn bitor(self, other: &FixedBitSet) -> FixedBitSet { let (short, long) = { if self.len() <= other.len() { (&self.data, &other.data) } else { (&other.data, &self.data) } }; let mut data = long.clone(); for (data, block) in data.iter_mut().zip(short.iter()) { *data |= *block; } let len = std::cmp::max(self.len(), other.len()); FixedBitSet { data, length: len } } } impl BitOrAssign for FixedBitSet { #[no_coverage] fn bitor_assign(&mut self, other: Self) { self.union_with(&other); } } impl BitOrAssign<&Self> for FixedBitSet { #[no_coverage] fn bitor_assign(&mut self, other: &Self) { self.union_with(other); } } impl<'a> BitXor for &'a FixedBitSet { type Output = FixedBitSet; #[no_coverage] fn bitxor(self, other: &FixedBitSet) -> FixedBitSet { let (short, long) = { if self.len() <= other.len() { (&self.data, &other.data) } else { (&other.data, &self.data) } }; let mut data = long.clone(); for (data, block) in data.iter_mut().zip(short.iter()) { *data ^= *block; } let len = std::cmp::max(self.len(), other.len()); FixedBitSet { data, length: len } } } impl BitXorAssign for FixedBitSet { #[no_coverage] fn bitxor_assign(&mut self, other: Self) { self.symmetric_difference_with(&other); } } impl BitXorAssign<&Self> for FixedBitSet { #[no_coverage] fn bitxor_assign(&mut self, other: &Self) { self.symmetric_difference_with(other); } }
use crate::mechanics::attack::Attack; use crate::mechanics::damage::Damage; use crate::mechanics::damage::deal_damage::DealDamage; use crate::mechanics::damage::receive_damage::ReceiveDamage; use crate::mechanics::Multiplier; use crate::types::MonsterType; pub mod dragons; pub mod sea_serpent; pub trait Monster: DealDamage + ReceiveDamage { fn primary_type(&self) -> MonsterType; fn secondary_type(&self) -> Option<MonsterType>; } impl<T: Monster> ReceiveDamage for T { fn calculate_inflicted_damage(&self, incoming_attack: Attack) -> Damage { let multiplier = MonsterType::calculate_damage_multiplier( self.primary_type(), self.secondary_type(), incoming_attack.monster_type(), ); Damage::new( incoming_attack.base_damage().value() * multiplier.multiplication_factor() as u32, ) } } #[cfg(test)] mod tests { use crate::mechanics::attack::Attack; use crate::mechanics::damage::Damage; use crate::mechanics::damage::receive_damage::ReceiveDamage; use crate::monsters::dragons::lava_dragon::LavaDragon; use crate::types::MonsterType::WATER; #[test] fn test_calculate_inflicted_damage() { let dragon = LavaDragon::new(5_u32); let attack = Attack::new(Damage::new(2_u32), WATER); let inflicted = dragon.calculate_inflicted_damage(attack); assert_eq!(inflicted.value(), 4_u32); } }
/// Sync message which outbound use crate::pool::TTLPool; use actix::prelude::*; use actix::{Actor, Addr, AsyncContext, Context, Handler}; use anyhow::{format_err, Result}; use bus::{BusActor, Subscription}; use chain::ChainActorRef; use futures::channel::mpsc; use parking_lot::RwLock; // use itertools; use crate::helper::{get_block_by_hash, get_hash_by_number, get_header_by_hash}; use crate::state_sync::StateSyncTaskActor; use config::NodeConfig; use crypto::HashValue; use logger::prelude::*; use network::{get_unix_ts, NetworkAsyncService}; use network_api::NetworkService; use starcoin_storage::Store; use starcoin_sync_api::sync_messages::{ BatchHashByNumberMsg, BatchHeaderMsg, BlockBody, DataType, GetDataByHashMsg, GetHashByNumberMsg, HashWithNumber, SyncNotify, }; use starcoin_sync_api::SyncMetadata; use std::collections::{HashMap, HashSet}; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::time::Duration; use traits::ChainAsyncService; use traits::{is_ok, ConnectBlockError, Consensus}; use types::{ block::{Block, BlockHeader, BlockInfo, BlockNumber}, peer_info::PeerId, system_events::SystemEvents, }; #[derive(Default, Debug, Message)] #[rtype(result = "Result<()>")] struct SyncEvent {} const MIN_PEER_SIZE: usize = 5; #[derive(Clone)] pub struct DownloadActor<C> where C: Consensus + Sync + Send + 'static + Clone, { downloader: Arc<Downloader<C>>, self_peer_id: Arc<PeerId>, network: NetworkAsyncService, bus: Addr<BusActor>, sync_event_sender: mpsc::Sender<SyncEvent>, sync_duration: Duration, syncing: Arc<AtomicBool>, ready: Arc<AtomicBool>, storage: Arc<dyn Store>, sync_metadata: SyncMetadata, main_network: bool, } impl<C> DownloadActor<C> where C: Consensus + Sync + Send + 'static + Clone, { pub fn launch( node_config: Arc<NodeConfig>, peer_id: Arc<PeerId>, chain_reader: ChainActorRef<C>, network: NetworkAsyncService, bus: Addr<BusActor>, storage: Arc<dyn Store>, sync_metadata: SyncMetadata, ) -> Result<Addr<DownloadActor<C>>> { let download_actor = DownloadActor::create(move |ctx| { let (sync_event_sender, sync_event_receiver) = mpsc::channel(100); ctx.add_message_stream(sync_event_receiver); DownloadActor { downloader: Arc::new(Downloader::new(chain_reader)), self_peer_id: peer_id, network, bus, sync_event_sender, sync_duration: Duration::from_secs(5), syncing: Arc::new(AtomicBool::new(false)), ready: Arc::new(AtomicBool::new(false)), storage, sync_metadata, main_network: node_config.base.net().is_main(), } }); Ok(download_actor) } fn sync_task(&mut self) { if !self.syncing.load(Ordering::Relaxed) && self.ready.load(Ordering::Relaxed) { self.syncing.store(true, Ordering::Relaxed); Self::sync_block_from_best_peer( self.sync_metadata.clone(), self.syncing.clone(), self.self_peer_id.as_ref().clone(), self.downloader.clone(), self.network.clone(), ); } } } impl<C> Actor for DownloadActor<C> where C: Consensus + Sync + Send + 'static + Clone, { type Context = Context<Self>; fn started(&mut self, ctx: &mut Self::Context) { let sys_event_recipient = ctx.address().recipient::<SystemEvents>(); self.bus .send(Subscription { recipient: sys_event_recipient, }) .into_actor(self) .then(|_res, act, _ctx| async {}.into_actor(act)) .wait(ctx); ctx.run_interval(self.sync_duration, move |act, _ctx| { if !act.syncing.load(Ordering::Relaxed) { if let Err(e) = act.sync_event_sender.try_send(SyncEvent {}) { warn!("err:{:?}", e); } } }); info!("download actor started.") } } impl<C> Handler<SystemEvents> for DownloadActor<C> where C: Consensus + Sync + Send + 'static + Clone, { type Result = (); fn handle(&mut self, msg: SystemEvents, _ctx: &mut Self::Context) -> Self::Result { match msg { SystemEvents::SyncBegin() => { info!("received SyncBegin event."); self.ready.store(true, Ordering::Relaxed); let downloader = self.downloader.clone(); let network = self.network.clone(); let storage = self.storage.clone(); let sync_metadata = self.sync_metadata.clone(); let is_main = self.main_network; let self_peer_id = self.self_peer_id.as_ref().clone(); Arbiter::spawn(async move { Self::sync_state( self_peer_id, is_main, downloader.clone(), network, storage, sync_metadata, ) .await; }); } _ => { info!("do nothing."); } } () } } impl<C> Handler<SyncEvent> for DownloadActor<C> where C: Consensus + Sync + Send + 'static + Clone, { type Result = Result<()>; fn handle(&mut self, _item: SyncEvent, _ctx: &mut Self::Context) -> Self::Result { self.sync_task(); Ok(()) } } impl<C> Handler<SyncNotify> for DownloadActor<C> where C: Consensus + Sync + Send + 'static + Clone, { type Result = (); fn handle(&mut self, msg: SyncNotify, _ctx: &mut Self::Context) -> Self::Result { let downloader = self.downloader.clone(); let network = self.network.clone(); let storage = self.storage.clone(); let sync_metadata = self.sync_metadata.clone(); let is_main = self.main_network; let self_peer_id = self.self_peer_id.as_ref().clone(); let ready = self.ready.load(Ordering::Relaxed); match msg { SyncNotify::NewPeerMsg(peer_id) => { info!("new peer msg: {:?}, ready: {}", peer_id, ready); if ready { Arbiter::spawn(async move { Self::sync_state( self_peer_id, is_main, downloader.clone(), network, storage, sync_metadata, ) .await; }); } } SyncNotify::NewHeadBlock(peer_id, block) => { info!( "receive new block: {:?} from {:?}", block.header().id(), peer_id ); // connect block Downloader::do_block_and_child(downloader.clone(), block, None); } SyncNotify::ClosePeerMsg(peer_id) => { info!("close peer: {:?}", peer_id,); } } () } } impl<C> DownloadActor<C> where C: Consensus + Sync + Send + 'static + Clone, { async fn sync_state( self_peer_id: PeerId, main_network: bool, downloader: Arc<Downloader<C>>, network: NetworkAsyncService, storage: Arc<dyn Store>, sync_metadata: SyncMetadata, ) { if let Err(e) = Self::sync_state_inner( self_peer_id, main_network, downloader, network, storage, sync_metadata, ) .await { error!("error : {:?}", e); } } async fn sync_state_inner( self_peer_id: PeerId, main_network: bool, downloader: Arc<Downloader<C>>, network: NetworkAsyncService, storage: Arc<dyn Store>, sync_metadata: SyncMetadata, ) -> Result<()> { if (main_network && network.get_peer_set_size().await? >= MIN_PEER_SIZE) || !main_network { if sync_metadata.state_syncing() { if let Some(best_peer) = network.best_peer().await? { if self_peer_id != best_peer.get_peer_id() { //1. ancestor let begin_number = downloader .chain_reader .clone() .master_head_header() .await .unwrap() .number(); if let Some(hash_with_number) = Downloader::find_ancestor( downloader.clone(), best_peer.get_peer_id(), network.clone(), begin_number, ) .await? { let ancestor = hash_with_number.number; // 2. pivot let latest_number = best_peer.get_block_number(); let min_behind = if main_network { MAIN_MIN_BLOCKS_BEHIND } else { MIN_BLOCKS_BEHIND }; if (ancestor + min_behind) <= latest_number { let pivot = latest_number - min_behind; // 3. StateSyncActor let root = Self::get_pivot(&network, best_peer.get_peer_id(), pivot) .await?; let sync_pivot = sync_metadata.get_pivot()?; if sync_metadata.state_syncing() { if sync_pivot.is_none() || sync_pivot.unwrap() < pivot { sync_metadata.clone().update_pivot(pivot, min_behind)?; if sync_pivot.is_none() { let state_sync_task_address = StateSyncTaskActor::launch( self_peer_id, (root.state_root(), root.accumulator_root()), storage, network.clone(), sync_metadata.clone(), ); sync_metadata .update_address(&state_sync_task_address)? } else if sync_pivot.unwrap() < pivot { if let Some(address) = sync_metadata.get_address() { &address.reset( root.state_root(), root.accumulator_root(), ); } else { info!("{:?}", "state sync reset address is none."); } } } else { info!("pivot {:?} : {}", sync_pivot, pivot); } } else { info!("{:?}", "not state sync mode."); } } } else { info!("{:?}", "find_ancestor return none."); } } else { info!("{:?}", "self is best peer."); } } else { info!("{:?}", "best peer is none."); } } else { info!("{:?}", "not state sync mode."); } } else { info!("{:?}", "nothing todo when sync state."); } Ok(()) } async fn get_pivot( network: &NetworkAsyncService, peer_id: PeerId, pivot: BlockNumber, ) -> Result<BlockHeader> { // 1. pivot hash let mut numbers: Vec<BlockNumber> = Vec::new(); numbers.push(pivot); let mut batch_hash_by_number_msg = get_hash_by_number(&network, peer_id.clone(), GetHashByNumberMsg { numbers }).await?; if let Some(hash_number) = batch_hash_by_number_msg.hashs.pop() { // 2. pivot header let mut hashs = Vec::new(); hashs.push(hash_number.hash); let mut headers = get_header_by_hash(&network, peer_id.clone(), hashs).await?; if let Some(header) = headers.headers.pop() { Ok(header) } else { Err(format_err!("{:?}", "pivot header is none.")) } } else { Err(format_err!("{:?}", "pivot hash is none.")) } } fn sync_block_from_best_peer( sync_metadata: SyncMetadata, syncing: Arc<AtomicBool>, self_peer_id: PeerId, downloader: Arc<Downloader<C>>, network: NetworkAsyncService, ) { Arbiter::spawn(async move { debug!("peer {:?} begin sync.", self_peer_id); if let Err(e) = Self::sync_block_from_best_peer_inner(self_peer_id.clone(), downloader, network) .await { error!("error: {:?}", e); } else { if !sync_metadata.state_sync_mode() { let _ = sync_metadata.block_sync_done(); } debug!("peer {:?} end sync.", self_peer_id); }; syncing.store(false, Ordering::Relaxed); }); } async fn sync_block_from_best_peer_inner( self_peer_id: PeerId, downloader: Arc<Downloader<C>>, network: NetworkAsyncService, ) -> Result<()> { if let Some(best_peer) = network.best_peer().await? { info!("peers: {:?}, {:?}", self_peer_id, best_peer.get_peer_id()); if let Some(header) = downloader.chain_reader.clone().master_head_header().await { let mut begin_number = header.number(); if let Some(hash_number) = Downloader::find_ancestor( downloader.clone(), best_peer.get_peer_id(), network.clone(), begin_number, ) .await? { begin_number = hash_number.number + 1; loop { //1. sync hash let _sync_begin_time = get_unix_ts(); if let Some((get_hash_by_number_msg, end, next_number)) = Downloader::<C>::get_hash_by_number_msg_forward( network.clone(), best_peer.get_peer_id(), begin_number, ) .await? { begin_number = next_number; let sync_hash_begin_time = get_unix_ts(); let batch_hash_by_number_msg = get_hash_by_number( &network, best_peer.get_peer_id(), get_hash_by_number_msg, ) .await?; let sync_hash_end_time = get_unix_ts(); debug!( "sync hash used time {:?}", (sync_hash_end_time - sync_hash_begin_time) ); Downloader::put_hash_2_hash_pool( downloader.clone(), best_peer.get_peer_id(), batch_hash_by_number_msg, ); let hashs = Downloader::take_task_from_hash_pool(downloader.clone()); if !hashs.is_empty() { let sync_block_begin_time = get_unix_ts(); let (headers, bodies, infos) = get_block_by_hash(&network, best_peer.get_peer_id(), hashs) .await?; let sync_block_end_time = get_unix_ts(); debug!( "sync block used time {:?}", (sync_block_end_time - sync_block_begin_time) ); Downloader::do_blocks( downloader.clone(), headers.headers, bodies.bodies, infos.infos, ); let do_block_end_time = get_unix_ts(); debug!( "sync block used time {:?}", (do_block_end_time - sync_block_end_time) ); } else { info!("{:?}", "hash pool is empty."); } if end { break; } } else { break; } } } } else { return Err(format_err!("{:?}", "block header is none.")); } } else { //return Err(format_err!("{:?}", "best peer is none.")); debug!("{:?}", "best peer is none."); } Ok(()) } } struct FutureBlockPool { child: Arc<RwLock<HashMap<HashValue, HashSet<HashValue>>>>, blocks: Arc<RwLock<HashMap<HashValue, (Block, Option<BlockInfo>)>>>, } impl FutureBlockPool { pub fn new() -> Self { FutureBlockPool { child: Arc::new(RwLock::new(HashMap::new())), blocks: Arc::new(RwLock::new(HashMap::new())), } } pub fn add_future_block(&self, block: Block, block_info: Option<BlockInfo>) { let block_id = block.header().id(); let parent_id = block.header().parent_hash(); if !self.blocks.read().contains_key(&block_id) { self.blocks.write().insert(block_id, (block, block_info)); } let mut lock = self.child.write(); if lock.contains_key(&parent_id) { lock.get_mut(&parent_id) .expect("parent not exist.") .insert(block_id); } else { let mut child = HashSet::new(); child.insert(block_id); lock.insert(parent_id, child); } } fn descendants(&self, parent_id: &HashValue) -> Vec<HashValue> { let mut child = Vec::new(); let lock = self.child.read(); if lock.contains_key(parent_id) { lock.get(parent_id) .expect("parent not exist.") .iter() .for_each(|id| { child.push(id.clone()); }); if !child.is_empty() { child.clone().iter().for_each(|new_parent_id| { let mut new_child = self.descendants(new_parent_id); if !new_child.is_empty() { child.append(&mut new_child); } }) } }; child } pub fn take_child(&self, parent_id: &HashValue) -> Option<Vec<(Block, Option<BlockInfo>)>> { let descendants = self.descendants(parent_id); if !descendants.is_empty() { let mut child = Vec::new(); let mut child_lock = self.child.write(); let mut block_lock = self.blocks.write(); descendants.iter().for_each(|id| { let _ = child_lock.remove(id); if let Some((block, block_info)) = block_lock.remove(id) { child.push((block, block_info)); } }); Some(child) } else { None } } } /// Send download message pub struct Downloader<C> where C: Consensus + Sync + Send + 'static + Clone, { hash_pool: TTLPool<HashWithNumber>, _header_pool: TTLPool<BlockHeader>, _body_pool: TTLPool<BlockBody>, chain_reader: ChainActorRef<C>, future_blocks: FutureBlockPool, } const HEAD_CT: u64 = 10; const MIN_BLOCKS_BEHIND: u64 = 10; const MAIN_MIN_BLOCKS_BEHIND: u64 = 100; impl<C> Downloader<C> where C: Consensus + Sync + Send + 'static + Clone, { pub fn new(chain_reader: ChainActorRef<C>) -> Self { Downloader { hash_pool: TTLPool::new(), _header_pool: TTLPool::new(), _body_pool: TTLPool::new(), chain_reader, future_blocks: FutureBlockPool::new(), } } /// for ancestors pub async fn get_hash_by_number_msg_backward( network: NetworkAsyncService, peer_id: PeerId, begin_number: u64, ) -> Result<Option<(GetHashByNumberMsg, bool, u64)>> { //todo:binary search if let Some(peer_info) = network.get_peer(&peer_id.clone().into()).await? { let number = peer_info.get_block_number(); info!( "sync with peer {:?} : latest number: {} , begin number : {}", peer_info.get_peer_id(), number, begin_number ); if begin_number < number { let mut numbers = Vec::new(); let mut end = false; let mut next_number = 0; if begin_number < HEAD_CT { for i in 0..(begin_number + 1) { info!("best peer backward number : {}, number : {}", number, i); numbers.push(i); end = true; } } else { for i in (begin_number - HEAD_CT + 1)..(begin_number + 1) { info!("best peer backward number : {}, number : {}, ", number, i); numbers.push(i); } next_number = begin_number - HEAD_CT; }; info!( "best peer backward number : {}, next number : {}", number, next_number ); Ok(Some((GetHashByNumberMsg { numbers }, end, next_number))) } else { info!("GetHashByNumberMsg is none."); Ok(None) } } else { Err(format_err!("peer {:?} not exist.", peer_id)) } } pub async fn get_hash_by_number_msg_forward( network: NetworkAsyncService, peer_id: PeerId, begin_number: u64, ) -> Result<Option<(GetHashByNumberMsg, bool, u64)>> { if let Some(peer_info) = network.get_peer(&peer_id.clone().into()).await? { let number = peer_info.get_block_number(); if begin_number < number { let mut numbers = Vec::new(); let mut end = false; let next_number = if (number - begin_number) < HEAD_CT { for i in begin_number..(number + 1) { info!("best peer forward number : {}, next number : {}", number, i,); numbers.push(i); end = true; } number + 1 } else { for i in begin_number..(begin_number + HEAD_CT) { info!("best peer forward number : {}, next number : {}", number, i,); numbers.push(i); } begin_number + HEAD_CT }; info!( "best peer forward number : {}, next number : {}", number, next_number ); Ok(Some((GetHashByNumberMsg { numbers }, end, next_number))) } else { Ok(None) } } else { Err(format_err!("peer {:?} not exist.", peer_id)) } } pub async fn find_ancestor( downloader: Arc<Downloader<C>>, peer_id: PeerId, network: NetworkAsyncService, block_number: BlockNumber, ) -> Result<Option<HashWithNumber>> { let mut hash_with_number = None; let mut begin_number = block_number; loop { if let Some((get_hash_by_number_msg, end, next_number)) = Downloader::<C>::get_hash_by_number_msg_backward( network.clone(), peer_id.clone(), begin_number, ) .await? { begin_number = next_number; info!( "peer: {:?} , numbers : {}", peer_id.clone(), get_hash_by_number_msg.numbers.len() ); let batch_hash_by_number_msg = get_hash_by_number(&network, peer_id.clone(), get_hash_by_number_msg).await?; debug!("batch_hash_by_number_msg:{:?}", batch_hash_by_number_msg); hash_with_number = Downloader::do_ancestor( downloader.clone(), peer_id.clone(), batch_hash_by_number_msg, ) .await; if end || hash_with_number.is_some() { if end && hash_with_number.is_none() { return Err(format_err!("{:?}", "find ancestor is none.")); } break; } } else { break; } } Ok(hash_with_number) } pub async fn do_ancestor( downloader: Arc<Downloader<C>>, peer: PeerId, batch_hash_by_number_msg: BatchHashByNumberMsg, ) -> Option<HashWithNumber> { //TODO let mut exist_ancestor = false; let mut ancestor = None; let mut hashs = batch_hash_by_number_msg.hashs.clone(); let mut not_exist_hash = Vec::new(); hashs.reverse(); for hash in hashs { if downloader .chain_reader .clone() .get_block_by_hash(hash.hash) .await .is_ok() { exist_ancestor = true; info!("find ancestor hash : {:?}", hash); ancestor = Some(hash); break; } else { not_exist_hash.push(hash); } } if exist_ancestor { for hash in not_exist_hash { downloader .hash_pool .insert(peer.clone(), hash.number.clone(), hash); } } ancestor } fn put_hash_2_hash_pool( downloader: Arc<Downloader<C>>, peer: PeerId, batch_hash_by_number_msg: BatchHashByNumberMsg, ) { for hash in batch_hash_by_number_msg.hashs { downloader .hash_pool .insert(peer.clone(), hash.number.clone(), hash); } } pub fn take_task_from_hash_pool(downloader: Arc<Downloader<C>>) -> Vec<HashValue> { let hash_vec = downloader.hash_pool.take(100); if !hash_vec.is_empty() { hash_vec.iter().map(|hash| hash.hash).collect() } else { Vec::new() } } pub async fn _put_header_2_header_pool( downloader: Arc<Downloader<C>>, peer: PeerId, batch_header_msg: BatchHeaderMsg, ) { if !batch_header_msg.headers.is_empty() { for header in batch_header_msg.headers { downloader ._header_pool .insert(peer.clone(), header.number(), header); } } } pub async fn _take_task_from_header_pool( downloader: Arc<Downloader<C>>, ) -> Option<GetDataByHashMsg> { let header_vec = downloader._header_pool.take(100); if !header_vec.is_empty() { let hashs = header_vec.iter().map(|header| header.id()).collect(); Some(GetDataByHashMsg { hashs, data_type: DataType::BODY, }) } else { None } } pub fn do_blocks( downloader: Arc<Downloader<C>>, headers: Vec<BlockHeader>, bodies: Vec<BlockBody>, infos: Vec<BlockInfo>, ) { assert_eq!(headers.len(), bodies.len()); for i in 0..headers.len() { let block = Block::new( headers.get(i).unwrap().clone(), bodies.get(i).unwrap().clone().transactions, ); let block_info = infos.get(i).unwrap().clone(); Self::do_block_and_child(downloader.clone(), block, Some(block_info)); } } fn do_block_and_child( downloader: Arc<Downloader<C>>, block: Block, block_info: Option<BlockInfo>, ) { Arbiter::spawn(async move { let block_id = block.header().id(); if Self::do_block(downloader.clone(), block, block_info).await { if let Some(child) = downloader.future_blocks.take_child(&block_id) { for (son_block, son_block_info) in child { let _ = Self::do_block(downloader.clone(), son_block, son_block_info).await; } } } }); } async fn do_block( downloader: Arc<Downloader<C>>, block: Block, block_info: Option<BlockInfo>, ) -> bool { info!("do block info {:?}", block.header().id()); let connect_result = if block_info.is_some() { downloader .chain_reader .clone() .try_connect_with_block_info(block.clone(), block_info.clone().unwrap()) .await } else { downloader .chain_reader .clone() .try_connect(block.clone()) .await }; match connect_result { Ok(connect) => { if is_ok(&connect) { return true; } else { if let Err(err) = connect { match err { ConnectBlockError::FutureBlock => { downloader.future_blocks.add_future_block(block, block_info) } _ => error!("err: {:?}", err), } } } } Err(e) => error!("err: {:?}", e), } return false; } }
extern crate iostream; use iostream::io::*; use std::fs::{File,remove_file}; #[test] fn test_copy(){ { let mut fs1 = File::open_fs("5.data", FileMode::CreateNew, FileAccess::ReadWrite).unwrap(); let i: [u8; 1024] = [55; 1024]; fs1.write(&i, 0, i.len()).unwrap(); fs1.flush().unwrap(); let mut fs2 = File::open_fs("6.data", FileMode::CreateNew, FileAccess::Write).unwrap(); fs1.copy_to(&mut fs2).unwrap(); fs2.flush().unwrap(); } let mut fs1 = File::open_fs("5.data", FileMode::Open, FileAccess::Read).unwrap(); let mut fs2 =File::open_fs("6.data", FileMode::Open, FileAccess::Read).unwrap(); let mut data1=Vec::new(); fs1.read_all(&mut data1).unwrap(); let mut data2:Vec<u8>=Vec::new(); fs2.read_all(&mut data2).unwrap(); assert_eq!(data1,data2); remove_file("5.data").unwrap(); remove_file("6.data").unwrap(); } #[test] fn test_rw(){ let mut fs = File::open_fs("7.data", FileMode::CreateNew, FileAccess::ReadWrite).unwrap(); let pd:Vec<u8>=vec![1,2,3,4,5]; fs.write_all(&pd).unwrap(); let pr:Vec<u8>=vec![1,2,3,4,5,6,7,8,9,0]; fs.write(&pr,5,5).unwrap(); fs.set_position(0).unwrap(); let mut rdata:Vec<u8>=vec![0;1024]; let len=rdata.len(); let size= fs.read(&mut rdata,0,len).unwrap(); rdata.resize(size,0); println!("{:?}",rdata); fs.set_position(0).unwrap(); let mut rdatac:Vec<u8>=Vec::new(); println!("{}",fs.length()); fs.read_all(&mut rdatac).unwrap(); assert_eq!(rdata,rdatac); remove_file("7.data").unwrap(); }
//! Gracefully degrade styled output mod strip; mod wincon; pub use strip::strip_bytes; pub use strip::strip_str; pub use strip::StripBytes; pub use strip::StripBytesIter; pub use strip::StripStr; pub use strip::StripStrIter; pub use strip::StrippedBytes; pub use strip::StrippedStr; pub use wincon::WinconBytes; pub use wincon::WinconBytesIter;
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtWidgets/qheaderview.h // dst-file: /src/widgets/qheaderview.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin => // <= main block end // use block begin => use super::qabstractitemview::*; // 773 use std::ops::Deref; use super::super::core::qsize::*; // 771 use super::super::core::qbytearray::*; // 771 use super::super::core::qpoint::*; // 771 use super::super::core::qobjectdefs::*; // 771 use super::qwidget::*; // 773 use super::super::core::qabstractitemmodel::*; // 771 // <= use block end // ext block begin => // #[link(name = "Qt5Core")] // #[link(name = "Qt5Gui")] // #[link(name = "Qt5Widgets")] // #[link(name = "QtInline")] extern { fn QHeaderView_Class_Size() -> c_int; // proto: int QHeaderView::maximumSectionSize(); fn C_ZNK11QHeaderView18maximumSectionSizeEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: QSize QHeaderView::sizeHint(); fn C_ZNK11QHeaderView8sizeHintEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: int QHeaderView::sectionPosition(int logicalIndex); fn C_ZNK11QHeaderView15sectionPositionEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_int; // proto: int QHeaderView::sectionSize(int logicalIndex); fn C_ZNK11QHeaderView11sectionSizeEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_int; // proto: void QHeaderView::setStretchLastSection(bool stretch); fn C_ZN11QHeaderView21setStretchLastSectionEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QHeaderView::reset(); fn C_ZN11QHeaderView5resetEv(qthis: u64 /* *mut c_void*/); // proto: void QHeaderView::resetDefaultSectionSize(); fn C_ZN11QHeaderView23resetDefaultSectionSizeEv(qthis: u64 /* *mut c_void*/); // proto: QByteArray QHeaderView::saveState(); fn C_ZNK11QHeaderView9saveStateEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: bool QHeaderView::sectionsClickable(); fn C_ZNK11QHeaderView17sectionsClickableEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: int QHeaderView::resizeContentsPrecision(); fn C_ZNK11QHeaderView23resizeContentsPrecisionEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QHeaderView::setOffsetToSectionPosition(int visualIndex); fn C_ZN11QHeaderView26setOffsetToSectionPositionEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: int QHeaderView::length(); fn C_ZNK11QHeaderView6lengthEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QHeaderView::hideSection(int logicalIndex); fn C_ZN11QHeaderView11hideSectionEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: int QHeaderView::sortIndicatorSection(); fn C_ZNK11QHeaderView20sortIndicatorSectionEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: bool QHeaderView::cascadingSectionResizes(); fn C_ZNK11QHeaderView23cascadingSectionResizesEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: void QHeaderView::setMinimumSectionSize(int size); fn C_ZN11QHeaderView21setMinimumSectionSizeEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: int QHeaderView::visualIndexAt(int position); fn C_ZNK11QHeaderView13visualIndexAtEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_int; // proto: void QHeaderView::setOffset(int offset); fn C_ZN11QHeaderView9setOffsetEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: int QHeaderView::logicalIndexAt(const QPoint & pos); fn C_ZNK11QHeaderView14logicalIndexAtERK6QPoint(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_int; // proto: void QHeaderView::~QHeaderView(); fn C_ZN11QHeaderViewD2Ev(qthis: u64 /* *mut c_void*/); // proto: int QHeaderView::sectionViewportPosition(int logicalIndex); fn C_ZNK11QHeaderView23sectionViewportPositionEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_int; // proto: bool QHeaderView::highlightSections(); fn C_ZNK11QHeaderView17highlightSectionsEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: int QHeaderView::offset(); fn C_ZNK11QHeaderView6offsetEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QHeaderView::setSortIndicatorShown(bool show); fn C_ZN11QHeaderView21setSortIndicatorShownEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: const QMetaObject * QHeaderView::metaObject(); fn C_ZNK11QHeaderView10metaObjectEv(qthis: u64 /* *mut c_void*/) -> *mut c_void; // proto: void QHeaderView::showSection(int logicalIndex); fn C_ZN11QHeaderView11showSectionEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QHeaderView::setVisible(bool v); fn C_ZN11QHeaderView10setVisibleEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: int QHeaderView::hiddenSectionCount(); fn C_ZNK11QHeaderView18hiddenSectionCountEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QHeaderView::setSectionsClickable(bool clickable); fn C_ZN11QHeaderView20setSectionsClickableEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QHeaderView::setResizeContentsPrecision(int precision); fn C_ZN11QHeaderView26setResizeContentsPrecisionEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: int QHeaderView::defaultSectionSize(); fn C_ZNK11QHeaderView18defaultSectionSizeEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QHeaderView::setOffsetToLastSection(); fn C_ZN11QHeaderView22setOffsetToLastSectionEv(qthis: u64 /* *mut c_void*/); // proto: void QHeaderView::swapSections(int first, int second); fn C_ZN11QHeaderView12swapSectionsEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int); // proto: int QHeaderView::count(); fn C_ZNK11QHeaderView5countEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: int QHeaderView::visualIndex(int logicalIndex); fn C_ZNK11QHeaderView11visualIndexEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_int; // proto: bool QHeaderView::sectionsMoved(); fn C_ZNK11QHeaderView13sectionsMovedEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: int QHeaderView::stretchSectionCount(); fn C_ZNK11QHeaderView19stretchSectionCountEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QHeaderView::doItemsLayout(); fn C_ZN11QHeaderView13doItemsLayoutEv(qthis: u64 /* *mut c_void*/); // proto: void QHeaderView::setSectionsMovable(bool movable); fn C_ZN11QHeaderView18setSectionsMovableEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: bool QHeaderView::sectionsHidden(); fn C_ZNK11QHeaderView14sectionsHiddenEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: int QHeaderView::minimumSectionSize(); fn C_ZNK11QHeaderView18minimumSectionSizeEv(qthis: u64 /* *mut c_void*/) -> c_int; // proto: void QHeaderView::setCascadingSectionResizes(bool enable); fn C_ZN11QHeaderView26setCascadingSectionResizesEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QHeaderView::setDefaultSectionSize(int size); fn C_ZN11QHeaderView21setDefaultSectionSizeEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QHeaderView::moveSection(int from, int to); fn C_ZN11QHeaderView11moveSectionEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int); // proto: bool QHeaderView::stretchLastSection(); fn C_ZNK11QHeaderView18stretchLastSectionEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: int QHeaderView::sectionSizeHint(int logicalIndex); fn C_ZNK11QHeaderView15sectionSizeHintEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_int; // proto: bool QHeaderView::sectionsMovable(); fn C_ZNK11QHeaderView15sectionsMovableEv(qthis: u64 /* *mut c_void*/) -> c_char; // proto: bool QHeaderView::isSectionHidden(int logicalIndex); fn C_ZNK11QHeaderView15isSectionHiddenEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_char; // proto: int QHeaderView::logicalIndexAt(int x, int y); fn C_ZNK11QHeaderView14logicalIndexAtEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int) -> c_int; // proto: int QHeaderView::logicalIndexAt(int position); fn C_ZNK11QHeaderView14logicalIndexAtEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_int; // proto: int QHeaderView::logicalIndex(int visualIndex); fn C_ZNK11QHeaderView12logicalIndexEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_int; // proto: void QHeaderView::setMaximumSectionSize(int size); fn C_ZN11QHeaderView21setMaximumSectionSizeEi(qthis: u64 /* *mut c_void*/, arg0: c_int); // proto: void QHeaderView::setHighlightSections(bool highlight); fn C_ZN11QHeaderView20setHighlightSectionsEb(qthis: u64 /* *mut c_void*/, arg0: c_char); // proto: void QHeaderView::setSectionHidden(int logicalIndex, bool hide); fn C_ZN11QHeaderView16setSectionHiddenEib(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_char); // proto: void QHeaderView::resizeSection(int logicalIndex, int size); fn C_ZN11QHeaderView13resizeSectionEii(qthis: u64 /* *mut c_void*/, arg0: c_int, arg1: c_int); // proto: bool QHeaderView::restoreState(const QByteArray & state); fn C_ZN11QHeaderView12restoreStateERK10QByteArray(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_char; // proto: void QHeaderView::setModel(QAbstractItemModel * model); fn C_ZN11QHeaderView8setModelEP18QAbstractItemModel(qthis: u64 /* *mut c_void*/, arg0: *mut c_void); // proto: bool QHeaderView::isSortIndicatorShown(); fn C_ZNK11QHeaderView20isSortIndicatorShownEv(qthis: u64 /* *mut c_void*/) -> c_char; fn QHeaderView_SlotProxy_connect__ZN11QHeaderView14sectionEnteredEi(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QHeaderView_SlotProxy_connect__ZN11QHeaderView17geometriesChangedEv(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QHeaderView_SlotProxy_connect__ZN11QHeaderView14sectionClickedEi(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QHeaderView_SlotProxy_connect__ZN11QHeaderView12sectionMovedEiii(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QHeaderView_SlotProxy_connect__ZN11QHeaderView14sectionPressedEi(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QHeaderView_SlotProxy_connect__ZN11QHeaderView20sectionDoubleClickedEi(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QHeaderView_SlotProxy_connect__ZN11QHeaderView26sectionHandleDoubleClickedEi(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QHeaderView_SlotProxy_connect__ZN11QHeaderView14sectionResizedEiii(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); fn QHeaderView_SlotProxy_connect__ZN11QHeaderView19sectionCountChangedEii(qthis: *mut c_void, ffifptr: *mut c_void, rsfptr: *mut c_void); } // <= ext block end // body block begin => // class sizeof(QHeaderView)=1 #[derive(Default)] pub struct QHeaderView { qbase: QAbstractItemView, pub qclsinst: u64 /* *mut c_void*/, pub _sectionHandleDoubleClicked: QHeaderView_sectionHandleDoubleClicked_signal, pub _sectionEntered: QHeaderView_sectionEntered_signal, pub _sortIndicatorChanged: QHeaderView_sortIndicatorChanged_signal, pub _sectionClicked: QHeaderView_sectionClicked_signal, pub _sectionCountChanged: QHeaderView_sectionCountChanged_signal, pub _geometriesChanged: QHeaderView_geometriesChanged_signal, pub _sectionMoved: QHeaderView_sectionMoved_signal, pub _sectionPressed: QHeaderView_sectionPressed_signal, pub _sectionDoubleClicked: QHeaderView_sectionDoubleClicked_signal, pub _sectionResized: QHeaderView_sectionResized_signal, } impl /*struct*/ QHeaderView { pub fn inheritFrom(qthis: u64 /* *mut c_void*/) -> QHeaderView { return QHeaderView{qbase: QAbstractItemView::inheritFrom(qthis), qclsinst: qthis, ..Default::default()}; } } impl Deref for QHeaderView { type Target = QAbstractItemView; fn deref(&self) -> &QAbstractItemView { return & self.qbase; } } impl AsRef<QAbstractItemView> for QHeaderView { fn as_ref(& self) -> & QAbstractItemView { return & self.qbase; } } // proto: int QHeaderView::maximumSectionSize(); impl /*struct*/ QHeaderView { pub fn maximumSectionSize<RetType, T: QHeaderView_maximumSectionSize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.maximumSectionSize(self); // return 1; } } pub trait QHeaderView_maximumSectionSize<RetType> { fn maximumSectionSize(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::maximumSectionSize(); impl<'a> /*trait*/ QHeaderView_maximumSectionSize<i32> for () { fn maximumSectionSize(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView18maximumSectionSizeEv()}; let mut ret = unsafe {C_ZNK11QHeaderView18maximumSectionSizeEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: QSize QHeaderView::sizeHint(); impl /*struct*/ QHeaderView { pub fn sizeHint<RetType, T: QHeaderView_sizeHint<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sizeHint(self); // return 1; } } pub trait QHeaderView_sizeHint<RetType> { fn sizeHint(self , rsthis: & QHeaderView) -> RetType; } // proto: QSize QHeaderView::sizeHint(); impl<'a> /*trait*/ QHeaderView_sizeHint<QSize> for () { fn sizeHint(self , rsthis: & QHeaderView) -> QSize { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView8sizeHintEv()}; let mut ret = unsafe {C_ZNK11QHeaderView8sizeHintEv(rsthis.qclsinst)}; let mut ret1 = QSize::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: int QHeaderView::sectionPosition(int logicalIndex); impl /*struct*/ QHeaderView { pub fn sectionPosition<RetType, T: QHeaderView_sectionPosition<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sectionPosition(self); // return 1; } } pub trait QHeaderView_sectionPosition<RetType> { fn sectionPosition(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::sectionPosition(int logicalIndex); impl<'a> /*trait*/ QHeaderView_sectionPosition<i32> for (i32) { fn sectionPosition(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView15sectionPositionEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK11QHeaderView15sectionPositionEi(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: int QHeaderView::sectionSize(int logicalIndex); impl /*struct*/ QHeaderView { pub fn sectionSize<RetType, T: QHeaderView_sectionSize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sectionSize(self); // return 1; } } pub trait QHeaderView_sectionSize<RetType> { fn sectionSize(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::sectionSize(int logicalIndex); impl<'a> /*trait*/ QHeaderView_sectionSize<i32> for (i32) { fn sectionSize(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView11sectionSizeEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK11QHeaderView11sectionSizeEi(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: void QHeaderView::setStretchLastSection(bool stretch); impl /*struct*/ QHeaderView { pub fn setStretchLastSection<RetType, T: QHeaderView_setStretchLastSection<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setStretchLastSection(self); // return 1; } } pub trait QHeaderView_setStretchLastSection<RetType> { fn setStretchLastSection(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setStretchLastSection(bool stretch); impl<'a> /*trait*/ QHeaderView_setStretchLastSection<()> for (i8) { fn setStretchLastSection(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView21setStretchLastSectionEb()}; let arg0 = self as c_char; unsafe {C_ZN11QHeaderView21setStretchLastSectionEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QHeaderView::reset(); impl /*struct*/ QHeaderView { pub fn reset<RetType, T: QHeaderView_reset<RetType>>(& self, overload_args: T) -> RetType { return overload_args.reset(self); // return 1; } } pub trait QHeaderView_reset<RetType> { fn reset(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::reset(); impl<'a> /*trait*/ QHeaderView_reset<()> for () { fn reset(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView5resetEv()}; unsafe {C_ZN11QHeaderView5resetEv(rsthis.qclsinst)}; // return 1; } } // proto: void QHeaderView::resetDefaultSectionSize(); impl /*struct*/ QHeaderView { pub fn resetDefaultSectionSize<RetType, T: QHeaderView_resetDefaultSectionSize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.resetDefaultSectionSize(self); // return 1; } } pub trait QHeaderView_resetDefaultSectionSize<RetType> { fn resetDefaultSectionSize(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::resetDefaultSectionSize(); impl<'a> /*trait*/ QHeaderView_resetDefaultSectionSize<()> for () { fn resetDefaultSectionSize(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView23resetDefaultSectionSizeEv()}; unsafe {C_ZN11QHeaderView23resetDefaultSectionSizeEv(rsthis.qclsinst)}; // return 1; } } // proto: QByteArray QHeaderView::saveState(); impl /*struct*/ QHeaderView { pub fn saveState<RetType, T: QHeaderView_saveState<RetType>>(& self, overload_args: T) -> RetType { return overload_args.saveState(self); // return 1; } } pub trait QHeaderView_saveState<RetType> { fn saveState(self , rsthis: & QHeaderView) -> RetType; } // proto: QByteArray QHeaderView::saveState(); impl<'a> /*trait*/ QHeaderView_saveState<QByteArray> for () { fn saveState(self , rsthis: & QHeaderView) -> QByteArray { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView9saveStateEv()}; let mut ret = unsafe {C_ZNK11QHeaderView9saveStateEv(rsthis.qclsinst)}; let mut ret1 = QByteArray::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: bool QHeaderView::sectionsClickable(); impl /*struct*/ QHeaderView { pub fn sectionsClickable<RetType, T: QHeaderView_sectionsClickable<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sectionsClickable(self); // return 1; } } pub trait QHeaderView_sectionsClickable<RetType> { fn sectionsClickable(self , rsthis: & QHeaderView) -> RetType; } // proto: bool QHeaderView::sectionsClickable(); impl<'a> /*trait*/ QHeaderView_sectionsClickable<i8> for () { fn sectionsClickable(self , rsthis: & QHeaderView) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView17sectionsClickableEv()}; let mut ret = unsafe {C_ZNK11QHeaderView17sectionsClickableEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: int QHeaderView::resizeContentsPrecision(); impl /*struct*/ QHeaderView { pub fn resizeContentsPrecision<RetType, T: QHeaderView_resizeContentsPrecision<RetType>>(& self, overload_args: T) -> RetType { return overload_args.resizeContentsPrecision(self); // return 1; } } pub trait QHeaderView_resizeContentsPrecision<RetType> { fn resizeContentsPrecision(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::resizeContentsPrecision(); impl<'a> /*trait*/ QHeaderView_resizeContentsPrecision<i32> for () { fn resizeContentsPrecision(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView23resizeContentsPrecisionEv()}; let mut ret = unsafe {C_ZNK11QHeaderView23resizeContentsPrecisionEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QHeaderView::setOffsetToSectionPosition(int visualIndex); impl /*struct*/ QHeaderView { pub fn setOffsetToSectionPosition<RetType, T: QHeaderView_setOffsetToSectionPosition<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setOffsetToSectionPosition(self); // return 1; } } pub trait QHeaderView_setOffsetToSectionPosition<RetType> { fn setOffsetToSectionPosition(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setOffsetToSectionPosition(int visualIndex); impl<'a> /*trait*/ QHeaderView_setOffsetToSectionPosition<()> for (i32) { fn setOffsetToSectionPosition(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView26setOffsetToSectionPositionEi()}; let arg0 = self as c_int; unsafe {C_ZN11QHeaderView26setOffsetToSectionPositionEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QHeaderView::length(); impl /*struct*/ QHeaderView { pub fn length<RetType, T: QHeaderView_length<RetType>>(& self, overload_args: T) -> RetType { return overload_args.length(self); // return 1; } } pub trait QHeaderView_length<RetType> { fn length(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::length(); impl<'a> /*trait*/ QHeaderView_length<i32> for () { fn length(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView6lengthEv()}; let mut ret = unsafe {C_ZNK11QHeaderView6lengthEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QHeaderView::hideSection(int logicalIndex); impl /*struct*/ QHeaderView { pub fn hideSection<RetType, T: QHeaderView_hideSection<RetType>>(& self, overload_args: T) -> RetType { return overload_args.hideSection(self); // return 1; } } pub trait QHeaderView_hideSection<RetType> { fn hideSection(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::hideSection(int logicalIndex); impl<'a> /*trait*/ QHeaderView_hideSection<()> for (i32) { fn hideSection(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView11hideSectionEi()}; let arg0 = self as c_int; unsafe {C_ZN11QHeaderView11hideSectionEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QHeaderView::sortIndicatorSection(); impl /*struct*/ QHeaderView { pub fn sortIndicatorSection<RetType, T: QHeaderView_sortIndicatorSection<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sortIndicatorSection(self); // return 1; } } pub trait QHeaderView_sortIndicatorSection<RetType> { fn sortIndicatorSection(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::sortIndicatorSection(); impl<'a> /*trait*/ QHeaderView_sortIndicatorSection<i32> for () { fn sortIndicatorSection(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView20sortIndicatorSectionEv()}; let mut ret = unsafe {C_ZNK11QHeaderView20sortIndicatorSectionEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: bool QHeaderView::cascadingSectionResizes(); impl /*struct*/ QHeaderView { pub fn cascadingSectionResizes<RetType, T: QHeaderView_cascadingSectionResizes<RetType>>(& self, overload_args: T) -> RetType { return overload_args.cascadingSectionResizes(self); // return 1; } } pub trait QHeaderView_cascadingSectionResizes<RetType> { fn cascadingSectionResizes(self , rsthis: & QHeaderView) -> RetType; } // proto: bool QHeaderView::cascadingSectionResizes(); impl<'a> /*trait*/ QHeaderView_cascadingSectionResizes<i8> for () { fn cascadingSectionResizes(self , rsthis: & QHeaderView) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView23cascadingSectionResizesEv()}; let mut ret = unsafe {C_ZNK11QHeaderView23cascadingSectionResizesEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QHeaderView::setMinimumSectionSize(int size); impl /*struct*/ QHeaderView { pub fn setMinimumSectionSize<RetType, T: QHeaderView_setMinimumSectionSize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setMinimumSectionSize(self); // return 1; } } pub trait QHeaderView_setMinimumSectionSize<RetType> { fn setMinimumSectionSize(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setMinimumSectionSize(int size); impl<'a> /*trait*/ QHeaderView_setMinimumSectionSize<()> for (i32) { fn setMinimumSectionSize(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView21setMinimumSectionSizeEi()}; let arg0 = self as c_int; unsafe {C_ZN11QHeaderView21setMinimumSectionSizeEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QHeaderView::visualIndexAt(int position); impl /*struct*/ QHeaderView { pub fn visualIndexAt<RetType, T: QHeaderView_visualIndexAt<RetType>>(& self, overload_args: T) -> RetType { return overload_args.visualIndexAt(self); // return 1; } } pub trait QHeaderView_visualIndexAt<RetType> { fn visualIndexAt(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::visualIndexAt(int position); impl<'a> /*trait*/ QHeaderView_visualIndexAt<i32> for (i32) { fn visualIndexAt(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView13visualIndexAtEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK11QHeaderView13visualIndexAtEi(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: void QHeaderView::setOffset(int offset); impl /*struct*/ QHeaderView { pub fn setOffset<RetType, T: QHeaderView_setOffset<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setOffset(self); // return 1; } } pub trait QHeaderView_setOffset<RetType> { fn setOffset(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setOffset(int offset); impl<'a> /*trait*/ QHeaderView_setOffset<()> for (i32) { fn setOffset(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView9setOffsetEi()}; let arg0 = self as c_int; unsafe {C_ZN11QHeaderView9setOffsetEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QHeaderView::logicalIndexAt(const QPoint & pos); impl /*struct*/ QHeaderView { pub fn logicalIndexAt<RetType, T: QHeaderView_logicalIndexAt<RetType>>(& self, overload_args: T) -> RetType { return overload_args.logicalIndexAt(self); // return 1; } } pub trait QHeaderView_logicalIndexAt<RetType> { fn logicalIndexAt(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::logicalIndexAt(const QPoint & pos); impl<'a> /*trait*/ QHeaderView_logicalIndexAt<i32> for (&'a QPoint) { fn logicalIndexAt(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView14logicalIndexAtERK6QPoint()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZNK11QHeaderView14logicalIndexAtERK6QPoint(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: void QHeaderView::~QHeaderView(); impl /*struct*/ QHeaderView { pub fn free<RetType, T: QHeaderView_free<RetType>>(& self, overload_args: T) -> RetType { return overload_args.free(self); // return 1; } } pub trait QHeaderView_free<RetType> { fn free(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::~QHeaderView(); impl<'a> /*trait*/ QHeaderView_free<()> for () { fn free(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderViewD2Ev()}; unsafe {C_ZN11QHeaderViewD2Ev(rsthis.qclsinst)}; // return 1; } } // proto: int QHeaderView::sectionViewportPosition(int logicalIndex); impl /*struct*/ QHeaderView { pub fn sectionViewportPosition<RetType, T: QHeaderView_sectionViewportPosition<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sectionViewportPosition(self); // return 1; } } pub trait QHeaderView_sectionViewportPosition<RetType> { fn sectionViewportPosition(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::sectionViewportPosition(int logicalIndex); impl<'a> /*trait*/ QHeaderView_sectionViewportPosition<i32> for (i32) { fn sectionViewportPosition(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView23sectionViewportPositionEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK11QHeaderView23sectionViewportPositionEi(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: bool QHeaderView::highlightSections(); impl /*struct*/ QHeaderView { pub fn highlightSections<RetType, T: QHeaderView_highlightSections<RetType>>(& self, overload_args: T) -> RetType { return overload_args.highlightSections(self); // return 1; } } pub trait QHeaderView_highlightSections<RetType> { fn highlightSections(self , rsthis: & QHeaderView) -> RetType; } // proto: bool QHeaderView::highlightSections(); impl<'a> /*trait*/ QHeaderView_highlightSections<i8> for () { fn highlightSections(self , rsthis: & QHeaderView) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView17highlightSectionsEv()}; let mut ret = unsafe {C_ZNK11QHeaderView17highlightSectionsEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: int QHeaderView::offset(); impl /*struct*/ QHeaderView { pub fn offset<RetType, T: QHeaderView_offset<RetType>>(& self, overload_args: T) -> RetType { return overload_args.offset(self); // return 1; } } pub trait QHeaderView_offset<RetType> { fn offset(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::offset(); impl<'a> /*trait*/ QHeaderView_offset<i32> for () { fn offset(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView6offsetEv()}; let mut ret = unsafe {C_ZNK11QHeaderView6offsetEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QHeaderView::setSortIndicatorShown(bool show); impl /*struct*/ QHeaderView { pub fn setSortIndicatorShown<RetType, T: QHeaderView_setSortIndicatorShown<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setSortIndicatorShown(self); // return 1; } } pub trait QHeaderView_setSortIndicatorShown<RetType> { fn setSortIndicatorShown(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setSortIndicatorShown(bool show); impl<'a> /*trait*/ QHeaderView_setSortIndicatorShown<()> for (i8) { fn setSortIndicatorShown(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView21setSortIndicatorShownEb()}; let arg0 = self as c_char; unsafe {C_ZN11QHeaderView21setSortIndicatorShownEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: const QMetaObject * QHeaderView::metaObject(); impl /*struct*/ QHeaderView { pub fn metaObject<RetType, T: QHeaderView_metaObject<RetType>>(& self, overload_args: T) -> RetType { return overload_args.metaObject(self); // return 1; } } pub trait QHeaderView_metaObject<RetType> { fn metaObject(self , rsthis: & QHeaderView) -> RetType; } // proto: const QMetaObject * QHeaderView::metaObject(); impl<'a> /*trait*/ QHeaderView_metaObject<QMetaObject> for () { fn metaObject(self , rsthis: & QHeaderView) -> QMetaObject { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView10metaObjectEv()}; let mut ret = unsafe {C_ZNK11QHeaderView10metaObjectEv(rsthis.qclsinst)}; let mut ret1 = QMetaObject::inheritFrom(ret as u64); return ret1; // return 1; } } // proto: void QHeaderView::showSection(int logicalIndex); impl /*struct*/ QHeaderView { pub fn showSection<RetType, T: QHeaderView_showSection<RetType>>(& self, overload_args: T) -> RetType { return overload_args.showSection(self); // return 1; } } pub trait QHeaderView_showSection<RetType> { fn showSection(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::showSection(int logicalIndex); impl<'a> /*trait*/ QHeaderView_showSection<()> for (i32) { fn showSection(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView11showSectionEi()}; let arg0 = self as c_int; unsafe {C_ZN11QHeaderView11showSectionEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QHeaderView::setVisible(bool v); impl /*struct*/ QHeaderView { pub fn setVisible<RetType, T: QHeaderView_setVisible<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setVisible(self); // return 1; } } pub trait QHeaderView_setVisible<RetType> { fn setVisible(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setVisible(bool v); impl<'a> /*trait*/ QHeaderView_setVisible<()> for (i8) { fn setVisible(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView10setVisibleEb()}; let arg0 = self as c_char; unsafe {C_ZN11QHeaderView10setVisibleEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QHeaderView::hiddenSectionCount(); impl /*struct*/ QHeaderView { pub fn hiddenSectionCount<RetType, T: QHeaderView_hiddenSectionCount<RetType>>(& self, overload_args: T) -> RetType { return overload_args.hiddenSectionCount(self); // return 1; } } pub trait QHeaderView_hiddenSectionCount<RetType> { fn hiddenSectionCount(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::hiddenSectionCount(); impl<'a> /*trait*/ QHeaderView_hiddenSectionCount<i32> for () { fn hiddenSectionCount(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView18hiddenSectionCountEv()}; let mut ret = unsafe {C_ZNK11QHeaderView18hiddenSectionCountEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QHeaderView::setSectionsClickable(bool clickable); impl /*struct*/ QHeaderView { pub fn setSectionsClickable<RetType, T: QHeaderView_setSectionsClickable<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setSectionsClickable(self); // return 1; } } pub trait QHeaderView_setSectionsClickable<RetType> { fn setSectionsClickable(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setSectionsClickable(bool clickable); impl<'a> /*trait*/ QHeaderView_setSectionsClickable<()> for (i8) { fn setSectionsClickable(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView20setSectionsClickableEb()}; let arg0 = self as c_char; unsafe {C_ZN11QHeaderView20setSectionsClickableEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QHeaderView::setResizeContentsPrecision(int precision); impl /*struct*/ QHeaderView { pub fn setResizeContentsPrecision<RetType, T: QHeaderView_setResizeContentsPrecision<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setResizeContentsPrecision(self); // return 1; } } pub trait QHeaderView_setResizeContentsPrecision<RetType> { fn setResizeContentsPrecision(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setResizeContentsPrecision(int precision); impl<'a> /*trait*/ QHeaderView_setResizeContentsPrecision<()> for (i32) { fn setResizeContentsPrecision(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView26setResizeContentsPrecisionEi()}; let arg0 = self as c_int; unsafe {C_ZN11QHeaderView26setResizeContentsPrecisionEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: int QHeaderView::defaultSectionSize(); impl /*struct*/ QHeaderView { pub fn defaultSectionSize<RetType, T: QHeaderView_defaultSectionSize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.defaultSectionSize(self); // return 1; } } pub trait QHeaderView_defaultSectionSize<RetType> { fn defaultSectionSize(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::defaultSectionSize(); impl<'a> /*trait*/ QHeaderView_defaultSectionSize<i32> for () { fn defaultSectionSize(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView18defaultSectionSizeEv()}; let mut ret = unsafe {C_ZNK11QHeaderView18defaultSectionSizeEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QHeaderView::setOffsetToLastSection(); impl /*struct*/ QHeaderView { pub fn setOffsetToLastSection<RetType, T: QHeaderView_setOffsetToLastSection<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setOffsetToLastSection(self); // return 1; } } pub trait QHeaderView_setOffsetToLastSection<RetType> { fn setOffsetToLastSection(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setOffsetToLastSection(); impl<'a> /*trait*/ QHeaderView_setOffsetToLastSection<()> for () { fn setOffsetToLastSection(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView22setOffsetToLastSectionEv()}; unsafe {C_ZN11QHeaderView22setOffsetToLastSectionEv(rsthis.qclsinst)}; // return 1; } } // proto: void QHeaderView::swapSections(int first, int second); impl /*struct*/ QHeaderView { pub fn swapSections<RetType, T: QHeaderView_swapSections<RetType>>(& self, overload_args: T) -> RetType { return overload_args.swapSections(self); // return 1; } } pub trait QHeaderView_swapSections<RetType> { fn swapSections(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::swapSections(int first, int second); impl<'a> /*trait*/ QHeaderView_swapSections<()> for (i32, i32) { fn swapSections(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView12swapSectionsEii()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; unsafe {C_ZN11QHeaderView12swapSectionsEii(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: int QHeaderView::count(); impl /*struct*/ QHeaderView { pub fn count<RetType, T: QHeaderView_count<RetType>>(& self, overload_args: T) -> RetType { return overload_args.count(self); // return 1; } } pub trait QHeaderView_count<RetType> { fn count(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::count(); impl<'a> /*trait*/ QHeaderView_count<i32> for () { fn count(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView5countEv()}; let mut ret = unsafe {C_ZNK11QHeaderView5countEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: int QHeaderView::visualIndex(int logicalIndex); impl /*struct*/ QHeaderView { pub fn visualIndex<RetType, T: QHeaderView_visualIndex<RetType>>(& self, overload_args: T) -> RetType { return overload_args.visualIndex(self); // return 1; } } pub trait QHeaderView_visualIndex<RetType> { fn visualIndex(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::visualIndex(int logicalIndex); impl<'a> /*trait*/ QHeaderView_visualIndex<i32> for (i32) { fn visualIndex(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView11visualIndexEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK11QHeaderView11visualIndexEi(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: bool QHeaderView::sectionsMoved(); impl /*struct*/ QHeaderView { pub fn sectionsMoved<RetType, T: QHeaderView_sectionsMoved<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sectionsMoved(self); // return 1; } } pub trait QHeaderView_sectionsMoved<RetType> { fn sectionsMoved(self , rsthis: & QHeaderView) -> RetType; } // proto: bool QHeaderView::sectionsMoved(); impl<'a> /*trait*/ QHeaderView_sectionsMoved<i8> for () { fn sectionsMoved(self , rsthis: & QHeaderView) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView13sectionsMovedEv()}; let mut ret = unsafe {C_ZNK11QHeaderView13sectionsMovedEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: int QHeaderView::stretchSectionCount(); impl /*struct*/ QHeaderView { pub fn stretchSectionCount<RetType, T: QHeaderView_stretchSectionCount<RetType>>(& self, overload_args: T) -> RetType { return overload_args.stretchSectionCount(self); // return 1; } } pub trait QHeaderView_stretchSectionCount<RetType> { fn stretchSectionCount(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::stretchSectionCount(); impl<'a> /*trait*/ QHeaderView_stretchSectionCount<i32> for () { fn stretchSectionCount(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView19stretchSectionCountEv()}; let mut ret = unsafe {C_ZNK11QHeaderView19stretchSectionCountEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QHeaderView::doItemsLayout(); impl /*struct*/ QHeaderView { pub fn doItemsLayout<RetType, T: QHeaderView_doItemsLayout<RetType>>(& self, overload_args: T) -> RetType { return overload_args.doItemsLayout(self); // return 1; } } pub trait QHeaderView_doItemsLayout<RetType> { fn doItemsLayout(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::doItemsLayout(); impl<'a> /*trait*/ QHeaderView_doItemsLayout<()> for () { fn doItemsLayout(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView13doItemsLayoutEv()}; unsafe {C_ZN11QHeaderView13doItemsLayoutEv(rsthis.qclsinst)}; // return 1; } } // proto: void QHeaderView::setSectionsMovable(bool movable); impl /*struct*/ QHeaderView { pub fn setSectionsMovable<RetType, T: QHeaderView_setSectionsMovable<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setSectionsMovable(self); // return 1; } } pub trait QHeaderView_setSectionsMovable<RetType> { fn setSectionsMovable(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setSectionsMovable(bool movable); impl<'a> /*trait*/ QHeaderView_setSectionsMovable<()> for (i8) { fn setSectionsMovable(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView18setSectionsMovableEb()}; let arg0 = self as c_char; unsafe {C_ZN11QHeaderView18setSectionsMovableEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QHeaderView::sectionsHidden(); impl /*struct*/ QHeaderView { pub fn sectionsHidden<RetType, T: QHeaderView_sectionsHidden<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sectionsHidden(self); // return 1; } } pub trait QHeaderView_sectionsHidden<RetType> { fn sectionsHidden(self , rsthis: & QHeaderView) -> RetType; } // proto: bool QHeaderView::sectionsHidden(); impl<'a> /*trait*/ QHeaderView_sectionsHidden<i8> for () { fn sectionsHidden(self , rsthis: & QHeaderView) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView14sectionsHiddenEv()}; let mut ret = unsafe {C_ZNK11QHeaderView14sectionsHiddenEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: int QHeaderView::minimumSectionSize(); impl /*struct*/ QHeaderView { pub fn minimumSectionSize<RetType, T: QHeaderView_minimumSectionSize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.minimumSectionSize(self); // return 1; } } pub trait QHeaderView_minimumSectionSize<RetType> { fn minimumSectionSize(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::minimumSectionSize(); impl<'a> /*trait*/ QHeaderView_minimumSectionSize<i32> for () { fn minimumSectionSize(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView18minimumSectionSizeEv()}; let mut ret = unsafe {C_ZNK11QHeaderView18minimumSectionSizeEv(rsthis.qclsinst)}; return ret as i32; // 1 // return 1; } } // proto: void QHeaderView::setCascadingSectionResizes(bool enable); impl /*struct*/ QHeaderView { pub fn setCascadingSectionResizes<RetType, T: QHeaderView_setCascadingSectionResizes<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setCascadingSectionResizes(self); // return 1; } } pub trait QHeaderView_setCascadingSectionResizes<RetType> { fn setCascadingSectionResizes(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setCascadingSectionResizes(bool enable); impl<'a> /*trait*/ QHeaderView_setCascadingSectionResizes<()> for (i8) { fn setCascadingSectionResizes(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView26setCascadingSectionResizesEb()}; let arg0 = self as c_char; unsafe {C_ZN11QHeaderView26setCascadingSectionResizesEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QHeaderView::setDefaultSectionSize(int size); impl /*struct*/ QHeaderView { pub fn setDefaultSectionSize<RetType, T: QHeaderView_setDefaultSectionSize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setDefaultSectionSize(self); // return 1; } } pub trait QHeaderView_setDefaultSectionSize<RetType> { fn setDefaultSectionSize(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setDefaultSectionSize(int size); impl<'a> /*trait*/ QHeaderView_setDefaultSectionSize<()> for (i32) { fn setDefaultSectionSize(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView21setDefaultSectionSizeEi()}; let arg0 = self as c_int; unsafe {C_ZN11QHeaderView21setDefaultSectionSizeEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QHeaderView::moveSection(int from, int to); impl /*struct*/ QHeaderView { pub fn moveSection<RetType, T: QHeaderView_moveSection<RetType>>(& self, overload_args: T) -> RetType { return overload_args.moveSection(self); // return 1; } } pub trait QHeaderView_moveSection<RetType> { fn moveSection(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::moveSection(int from, int to); impl<'a> /*trait*/ QHeaderView_moveSection<()> for (i32, i32) { fn moveSection(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView11moveSectionEii()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; unsafe {C_ZN11QHeaderView11moveSectionEii(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: bool QHeaderView::stretchLastSection(); impl /*struct*/ QHeaderView { pub fn stretchLastSection<RetType, T: QHeaderView_stretchLastSection<RetType>>(& self, overload_args: T) -> RetType { return overload_args.stretchLastSection(self); // return 1; } } pub trait QHeaderView_stretchLastSection<RetType> { fn stretchLastSection(self , rsthis: & QHeaderView) -> RetType; } // proto: bool QHeaderView::stretchLastSection(); impl<'a> /*trait*/ QHeaderView_stretchLastSection<i8> for () { fn stretchLastSection(self , rsthis: & QHeaderView) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView18stretchLastSectionEv()}; let mut ret = unsafe {C_ZNK11QHeaderView18stretchLastSectionEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: int QHeaderView::sectionSizeHint(int logicalIndex); impl /*struct*/ QHeaderView { pub fn sectionSizeHint<RetType, T: QHeaderView_sectionSizeHint<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sectionSizeHint(self); // return 1; } } pub trait QHeaderView_sectionSizeHint<RetType> { fn sectionSizeHint(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::sectionSizeHint(int logicalIndex); impl<'a> /*trait*/ QHeaderView_sectionSizeHint<i32> for (i32) { fn sectionSizeHint(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView15sectionSizeHintEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK11QHeaderView15sectionSizeHintEi(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: bool QHeaderView::sectionsMovable(); impl /*struct*/ QHeaderView { pub fn sectionsMovable<RetType, T: QHeaderView_sectionsMovable<RetType>>(& self, overload_args: T) -> RetType { return overload_args.sectionsMovable(self); // return 1; } } pub trait QHeaderView_sectionsMovable<RetType> { fn sectionsMovable(self , rsthis: & QHeaderView) -> RetType; } // proto: bool QHeaderView::sectionsMovable(); impl<'a> /*trait*/ QHeaderView_sectionsMovable<i8> for () { fn sectionsMovable(self , rsthis: & QHeaderView) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView15sectionsMovableEv()}; let mut ret = unsafe {C_ZNK11QHeaderView15sectionsMovableEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: bool QHeaderView::isSectionHidden(int logicalIndex); impl /*struct*/ QHeaderView { pub fn isSectionHidden<RetType, T: QHeaderView_isSectionHidden<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isSectionHidden(self); // return 1; } } pub trait QHeaderView_isSectionHidden<RetType> { fn isSectionHidden(self , rsthis: & QHeaderView) -> RetType; } // proto: bool QHeaderView::isSectionHidden(int logicalIndex); impl<'a> /*trait*/ QHeaderView_isSectionHidden<i8> for (i32) { fn isSectionHidden(self , rsthis: & QHeaderView) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView15isSectionHiddenEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK11QHeaderView15isSectionHiddenEi(rsthis.qclsinst, arg0)}; return ret as i8; // 1 // return 1; } } // proto: int QHeaderView::logicalIndexAt(int x, int y); impl<'a> /*trait*/ QHeaderView_logicalIndexAt<i32> for (i32, i32) { fn logicalIndexAt(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView14logicalIndexAtEii()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; let mut ret = unsafe {C_ZNK11QHeaderView14logicalIndexAtEii(rsthis.qclsinst, arg0, arg1)}; return ret as i32; // 1 // return 1; } } // proto: int QHeaderView::logicalIndexAt(int position); impl<'a> /*trait*/ QHeaderView_logicalIndexAt<i32> for (i32) { fn logicalIndexAt(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView14logicalIndexAtEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK11QHeaderView14logicalIndexAtEi(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: int QHeaderView::logicalIndex(int visualIndex); impl /*struct*/ QHeaderView { pub fn logicalIndex<RetType, T: QHeaderView_logicalIndex<RetType>>(& self, overload_args: T) -> RetType { return overload_args.logicalIndex(self); // return 1; } } pub trait QHeaderView_logicalIndex<RetType> { fn logicalIndex(self , rsthis: & QHeaderView) -> RetType; } // proto: int QHeaderView::logicalIndex(int visualIndex); impl<'a> /*trait*/ QHeaderView_logicalIndex<i32> for (i32) { fn logicalIndex(self , rsthis: & QHeaderView) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView12logicalIndexEi()}; let arg0 = self as c_int; let mut ret = unsafe {C_ZNK11QHeaderView12logicalIndexEi(rsthis.qclsinst, arg0)}; return ret as i32; // 1 // return 1; } } // proto: void QHeaderView::setMaximumSectionSize(int size); impl /*struct*/ QHeaderView { pub fn setMaximumSectionSize<RetType, T: QHeaderView_setMaximumSectionSize<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setMaximumSectionSize(self); // return 1; } } pub trait QHeaderView_setMaximumSectionSize<RetType> { fn setMaximumSectionSize(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setMaximumSectionSize(int size); impl<'a> /*trait*/ QHeaderView_setMaximumSectionSize<()> for (i32) { fn setMaximumSectionSize(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView21setMaximumSectionSizeEi()}; let arg0 = self as c_int; unsafe {C_ZN11QHeaderView21setMaximumSectionSizeEi(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QHeaderView::setHighlightSections(bool highlight); impl /*struct*/ QHeaderView { pub fn setHighlightSections<RetType, T: QHeaderView_setHighlightSections<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setHighlightSections(self); // return 1; } } pub trait QHeaderView_setHighlightSections<RetType> { fn setHighlightSections(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setHighlightSections(bool highlight); impl<'a> /*trait*/ QHeaderView_setHighlightSections<()> for (i8) { fn setHighlightSections(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView20setHighlightSectionsEb()}; let arg0 = self as c_char; unsafe {C_ZN11QHeaderView20setHighlightSectionsEb(rsthis.qclsinst, arg0)}; // return 1; } } // proto: void QHeaderView::setSectionHidden(int logicalIndex, bool hide); impl /*struct*/ QHeaderView { pub fn setSectionHidden<RetType, T: QHeaderView_setSectionHidden<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setSectionHidden(self); // return 1; } } pub trait QHeaderView_setSectionHidden<RetType> { fn setSectionHidden(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setSectionHidden(int logicalIndex, bool hide); impl<'a> /*trait*/ QHeaderView_setSectionHidden<()> for (i32, i8) { fn setSectionHidden(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView16setSectionHiddenEib()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_char; unsafe {C_ZN11QHeaderView16setSectionHiddenEib(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: void QHeaderView::resizeSection(int logicalIndex, int size); impl /*struct*/ QHeaderView { pub fn resizeSection<RetType, T: QHeaderView_resizeSection<RetType>>(& self, overload_args: T) -> RetType { return overload_args.resizeSection(self); // return 1; } } pub trait QHeaderView_resizeSection<RetType> { fn resizeSection(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::resizeSection(int logicalIndex, int size); impl<'a> /*trait*/ QHeaderView_resizeSection<()> for (i32, i32) { fn resizeSection(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView13resizeSectionEii()}; let arg0 = self.0 as c_int; let arg1 = self.1 as c_int; unsafe {C_ZN11QHeaderView13resizeSectionEii(rsthis.qclsinst, arg0, arg1)}; // return 1; } } // proto: bool QHeaderView::restoreState(const QByteArray & state); impl /*struct*/ QHeaderView { pub fn restoreState<RetType, T: QHeaderView_restoreState<RetType>>(& self, overload_args: T) -> RetType { return overload_args.restoreState(self); // return 1; } } pub trait QHeaderView_restoreState<RetType> { fn restoreState(self , rsthis: & QHeaderView) -> RetType; } // proto: bool QHeaderView::restoreState(const QByteArray & state); impl<'a> /*trait*/ QHeaderView_restoreState<i8> for (&'a QByteArray) { fn restoreState(self , rsthis: & QHeaderView) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView12restoreStateERK10QByteArray()}; let arg0 = self.qclsinst as *mut c_void; let mut ret = unsafe {C_ZN11QHeaderView12restoreStateERK10QByteArray(rsthis.qclsinst, arg0)}; return ret as i8; // 1 // return 1; } } // proto: void QHeaderView::setModel(QAbstractItemModel * model); impl /*struct*/ QHeaderView { pub fn setModel<RetType, T: QHeaderView_setModel<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setModel(self); // return 1; } } pub trait QHeaderView_setModel<RetType> { fn setModel(self , rsthis: & QHeaderView) -> RetType; } // proto: void QHeaderView::setModel(QAbstractItemModel * model); impl<'a> /*trait*/ QHeaderView_setModel<()> for (&'a QAbstractItemModel) { fn setModel(self , rsthis: & QHeaderView) -> () { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZN11QHeaderView8setModelEP18QAbstractItemModel()}; let arg0 = self.qclsinst as *mut c_void; unsafe {C_ZN11QHeaderView8setModelEP18QAbstractItemModel(rsthis.qclsinst, arg0)}; // return 1; } } // proto: bool QHeaderView::isSortIndicatorShown(); impl /*struct*/ QHeaderView { pub fn isSortIndicatorShown<RetType, T: QHeaderView_isSortIndicatorShown<RetType>>(& self, overload_args: T) -> RetType { return overload_args.isSortIndicatorShown(self); // return 1; } } pub trait QHeaderView_isSortIndicatorShown<RetType> { fn isSortIndicatorShown(self , rsthis: & QHeaderView) -> RetType; } // proto: bool QHeaderView::isSortIndicatorShown(); impl<'a> /*trait*/ QHeaderView_isSortIndicatorShown<i8> for () { fn isSortIndicatorShown(self , rsthis: & QHeaderView) -> i8 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK11QHeaderView20isSortIndicatorShownEv()}; let mut ret = unsafe {C_ZNK11QHeaderView20isSortIndicatorShownEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } #[derive(Default)] // for QHeaderView_sectionHandleDoubleClicked pub struct QHeaderView_sectionHandleDoubleClicked_signal{poi:u64} impl /* struct */ QHeaderView { pub fn sectionHandleDoubleClicked(&self) -> QHeaderView_sectionHandleDoubleClicked_signal { return QHeaderView_sectionHandleDoubleClicked_signal{poi:self.qclsinst}; } } impl /* struct */ QHeaderView_sectionHandleDoubleClicked_signal { pub fn connect<T: QHeaderView_sectionHandleDoubleClicked_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QHeaderView_sectionHandleDoubleClicked_signal_connect { fn connect(self, sigthis: QHeaderView_sectionHandleDoubleClicked_signal); } #[derive(Default)] // for QHeaderView_sectionEntered pub struct QHeaderView_sectionEntered_signal{poi:u64} impl /* struct */ QHeaderView { pub fn sectionEntered(&self) -> QHeaderView_sectionEntered_signal { return QHeaderView_sectionEntered_signal{poi:self.qclsinst}; } } impl /* struct */ QHeaderView_sectionEntered_signal { pub fn connect<T: QHeaderView_sectionEntered_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QHeaderView_sectionEntered_signal_connect { fn connect(self, sigthis: QHeaderView_sectionEntered_signal); } #[derive(Default)] // for QHeaderView_sortIndicatorChanged pub struct QHeaderView_sortIndicatorChanged_signal{poi:u64} impl /* struct */ QHeaderView { pub fn sortIndicatorChanged(&self) -> QHeaderView_sortIndicatorChanged_signal { return QHeaderView_sortIndicatorChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QHeaderView_sortIndicatorChanged_signal { pub fn connect<T: QHeaderView_sortIndicatorChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QHeaderView_sortIndicatorChanged_signal_connect { fn connect(self, sigthis: QHeaderView_sortIndicatorChanged_signal); } #[derive(Default)] // for QHeaderView_sectionClicked pub struct QHeaderView_sectionClicked_signal{poi:u64} impl /* struct */ QHeaderView { pub fn sectionClicked(&self) -> QHeaderView_sectionClicked_signal { return QHeaderView_sectionClicked_signal{poi:self.qclsinst}; } } impl /* struct */ QHeaderView_sectionClicked_signal { pub fn connect<T: QHeaderView_sectionClicked_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QHeaderView_sectionClicked_signal_connect { fn connect(self, sigthis: QHeaderView_sectionClicked_signal); } #[derive(Default)] // for QHeaderView_sectionCountChanged pub struct QHeaderView_sectionCountChanged_signal{poi:u64} impl /* struct */ QHeaderView { pub fn sectionCountChanged(&self) -> QHeaderView_sectionCountChanged_signal { return QHeaderView_sectionCountChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QHeaderView_sectionCountChanged_signal { pub fn connect<T: QHeaderView_sectionCountChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QHeaderView_sectionCountChanged_signal_connect { fn connect(self, sigthis: QHeaderView_sectionCountChanged_signal); } #[derive(Default)] // for QHeaderView_geometriesChanged pub struct QHeaderView_geometriesChanged_signal{poi:u64} impl /* struct */ QHeaderView { pub fn geometriesChanged(&self) -> QHeaderView_geometriesChanged_signal { return QHeaderView_geometriesChanged_signal{poi:self.qclsinst}; } } impl /* struct */ QHeaderView_geometriesChanged_signal { pub fn connect<T: QHeaderView_geometriesChanged_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QHeaderView_geometriesChanged_signal_connect { fn connect(self, sigthis: QHeaderView_geometriesChanged_signal); } #[derive(Default)] // for QHeaderView_sectionMoved pub struct QHeaderView_sectionMoved_signal{poi:u64} impl /* struct */ QHeaderView { pub fn sectionMoved(&self) -> QHeaderView_sectionMoved_signal { return QHeaderView_sectionMoved_signal{poi:self.qclsinst}; } } impl /* struct */ QHeaderView_sectionMoved_signal { pub fn connect<T: QHeaderView_sectionMoved_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QHeaderView_sectionMoved_signal_connect { fn connect(self, sigthis: QHeaderView_sectionMoved_signal); } #[derive(Default)] // for QHeaderView_sectionPressed pub struct QHeaderView_sectionPressed_signal{poi:u64} impl /* struct */ QHeaderView { pub fn sectionPressed(&self) -> QHeaderView_sectionPressed_signal { return QHeaderView_sectionPressed_signal{poi:self.qclsinst}; } } impl /* struct */ QHeaderView_sectionPressed_signal { pub fn connect<T: QHeaderView_sectionPressed_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QHeaderView_sectionPressed_signal_connect { fn connect(self, sigthis: QHeaderView_sectionPressed_signal); } #[derive(Default)] // for QHeaderView_sectionDoubleClicked pub struct QHeaderView_sectionDoubleClicked_signal{poi:u64} impl /* struct */ QHeaderView { pub fn sectionDoubleClicked(&self) -> QHeaderView_sectionDoubleClicked_signal { return QHeaderView_sectionDoubleClicked_signal{poi:self.qclsinst}; } } impl /* struct */ QHeaderView_sectionDoubleClicked_signal { pub fn connect<T: QHeaderView_sectionDoubleClicked_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QHeaderView_sectionDoubleClicked_signal_connect { fn connect(self, sigthis: QHeaderView_sectionDoubleClicked_signal); } #[derive(Default)] // for QHeaderView_sectionResized pub struct QHeaderView_sectionResized_signal{poi:u64} impl /* struct */ QHeaderView { pub fn sectionResized(&self) -> QHeaderView_sectionResized_signal { return QHeaderView_sectionResized_signal{poi:self.qclsinst}; } } impl /* struct */ QHeaderView_sectionResized_signal { pub fn connect<T: QHeaderView_sectionResized_signal_connect>(self, overload_args: T) { overload_args.connect(self); } } pub trait QHeaderView_sectionResized_signal_connect { fn connect(self, sigthis: QHeaderView_sectionResized_signal); } // sectionEntered(int) extern fn QHeaderView_sectionEntered_signal_connect_cb_0(rsfptr:fn(i32), arg0: c_int) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i32; rsfptr(rsarg0); } extern fn QHeaderView_sectionEntered_signal_connect_cb_box_0(rsfptr_raw:*mut Box<Fn(i32)>, arg0: c_int) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i32; // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QHeaderView_sectionEntered_signal_connect for fn(i32) { fn connect(self, sigthis: QHeaderView_sectionEntered_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionEntered_signal_connect_cb_0 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView14sectionEnteredEi(arg0, arg1, arg2)}; } } impl /* trait */ QHeaderView_sectionEntered_signal_connect for Box<Fn(i32)> { fn connect(self, sigthis: QHeaderView_sectionEntered_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionEntered_signal_connect_cb_box_0 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView14sectionEnteredEi(arg0, arg1, arg2)}; } } // geometriesChanged() extern fn QHeaderView_geometriesChanged_signal_connect_cb_1(rsfptr:fn(), ) { println!("{}:{}", file!(), line!()); rsfptr(); } extern fn QHeaderView_geometriesChanged_signal_connect_cb_box_1(rsfptr_raw:*mut Box<Fn()>, ) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; // rsfptr(); unsafe{(*rsfptr_raw)()}; } impl /* trait */ QHeaderView_geometriesChanged_signal_connect for fn() { fn connect(self, sigthis: QHeaderView_geometriesChanged_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_geometriesChanged_signal_connect_cb_1 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView17geometriesChangedEv(arg0, arg1, arg2)}; } } impl /* trait */ QHeaderView_geometriesChanged_signal_connect for Box<Fn()> { fn connect(self, sigthis: QHeaderView_geometriesChanged_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_geometriesChanged_signal_connect_cb_box_1 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView17geometriesChangedEv(arg0, arg1, arg2)}; } } // sectionClicked(int) extern fn QHeaderView_sectionClicked_signal_connect_cb_2(rsfptr:fn(i32), arg0: c_int) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i32; rsfptr(rsarg0); } extern fn QHeaderView_sectionClicked_signal_connect_cb_box_2(rsfptr_raw:*mut Box<Fn(i32)>, arg0: c_int) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i32; // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QHeaderView_sectionClicked_signal_connect for fn(i32) { fn connect(self, sigthis: QHeaderView_sectionClicked_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionClicked_signal_connect_cb_2 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView14sectionClickedEi(arg0, arg1, arg2)}; } } impl /* trait */ QHeaderView_sectionClicked_signal_connect for Box<Fn(i32)> { fn connect(self, sigthis: QHeaderView_sectionClicked_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionClicked_signal_connect_cb_box_2 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView14sectionClickedEi(arg0, arg1, arg2)}; } } // sectionMoved(int, int, int) extern fn QHeaderView_sectionMoved_signal_connect_cb_3(rsfptr:fn(i32, i32, i32), arg0: c_int, arg1: c_int, arg2: c_int) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i32; let rsarg1 = arg1 as i32; let rsarg2 = arg2 as i32; rsfptr(rsarg0,rsarg1,rsarg2); } extern fn QHeaderView_sectionMoved_signal_connect_cb_box_3(rsfptr_raw:*mut Box<Fn(i32, i32, i32)>, arg0: c_int, arg1: c_int, arg2: c_int) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i32; let rsarg1 = arg1 as i32; let rsarg2 = arg2 as i32; // rsfptr(rsarg0,rsarg1,rsarg2); unsafe{(*rsfptr_raw)(rsarg0,rsarg1,rsarg2)}; } impl /* trait */ QHeaderView_sectionMoved_signal_connect for fn(i32, i32, i32) { fn connect(self, sigthis: QHeaderView_sectionMoved_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionMoved_signal_connect_cb_3 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView12sectionMovedEiii(arg0, arg1, arg2)}; } } impl /* trait */ QHeaderView_sectionMoved_signal_connect for Box<Fn(i32, i32, i32)> { fn connect(self, sigthis: QHeaderView_sectionMoved_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionMoved_signal_connect_cb_box_3 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView12sectionMovedEiii(arg0, arg1, arg2)}; } } // sectionPressed(int) extern fn QHeaderView_sectionPressed_signal_connect_cb_4(rsfptr:fn(i32), arg0: c_int) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i32; rsfptr(rsarg0); } extern fn QHeaderView_sectionPressed_signal_connect_cb_box_4(rsfptr_raw:*mut Box<Fn(i32)>, arg0: c_int) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i32; // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QHeaderView_sectionPressed_signal_connect for fn(i32) { fn connect(self, sigthis: QHeaderView_sectionPressed_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionPressed_signal_connect_cb_4 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView14sectionPressedEi(arg0, arg1, arg2)}; } } impl /* trait */ QHeaderView_sectionPressed_signal_connect for Box<Fn(i32)> { fn connect(self, sigthis: QHeaderView_sectionPressed_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionPressed_signal_connect_cb_box_4 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView14sectionPressedEi(arg0, arg1, arg2)}; } } // sectionDoubleClicked(int) extern fn QHeaderView_sectionDoubleClicked_signal_connect_cb_5(rsfptr:fn(i32), arg0: c_int) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i32; rsfptr(rsarg0); } extern fn QHeaderView_sectionDoubleClicked_signal_connect_cb_box_5(rsfptr_raw:*mut Box<Fn(i32)>, arg0: c_int) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i32; // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QHeaderView_sectionDoubleClicked_signal_connect for fn(i32) { fn connect(self, sigthis: QHeaderView_sectionDoubleClicked_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionDoubleClicked_signal_connect_cb_5 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView20sectionDoubleClickedEi(arg0, arg1, arg2)}; } } impl /* trait */ QHeaderView_sectionDoubleClicked_signal_connect for Box<Fn(i32)> { fn connect(self, sigthis: QHeaderView_sectionDoubleClicked_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionDoubleClicked_signal_connect_cb_box_5 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView20sectionDoubleClickedEi(arg0, arg1, arg2)}; } } // sectionHandleDoubleClicked(int) extern fn QHeaderView_sectionHandleDoubleClicked_signal_connect_cb_6(rsfptr:fn(i32), arg0: c_int) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i32; rsfptr(rsarg0); } extern fn QHeaderView_sectionHandleDoubleClicked_signal_connect_cb_box_6(rsfptr_raw:*mut Box<Fn(i32)>, arg0: c_int) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i32; // rsfptr(rsarg0); unsafe{(*rsfptr_raw)(rsarg0)}; } impl /* trait */ QHeaderView_sectionHandleDoubleClicked_signal_connect for fn(i32) { fn connect(self, sigthis: QHeaderView_sectionHandleDoubleClicked_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionHandleDoubleClicked_signal_connect_cb_6 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView26sectionHandleDoubleClickedEi(arg0, arg1, arg2)}; } } impl /* trait */ QHeaderView_sectionHandleDoubleClicked_signal_connect for Box<Fn(i32)> { fn connect(self, sigthis: QHeaderView_sectionHandleDoubleClicked_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionHandleDoubleClicked_signal_connect_cb_box_6 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView26sectionHandleDoubleClickedEi(arg0, arg1, arg2)}; } } // sectionResized(int, int, int) extern fn QHeaderView_sectionResized_signal_connect_cb_7(rsfptr:fn(i32, i32, i32), arg0: c_int, arg1: c_int, arg2: c_int) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i32; let rsarg1 = arg1 as i32; let rsarg2 = arg2 as i32; rsfptr(rsarg0,rsarg1,rsarg2); } extern fn QHeaderView_sectionResized_signal_connect_cb_box_7(rsfptr_raw:*mut Box<Fn(i32, i32, i32)>, arg0: c_int, arg1: c_int, arg2: c_int) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i32; let rsarg1 = arg1 as i32; let rsarg2 = arg2 as i32; // rsfptr(rsarg0,rsarg1,rsarg2); unsafe{(*rsfptr_raw)(rsarg0,rsarg1,rsarg2)}; } impl /* trait */ QHeaderView_sectionResized_signal_connect for fn(i32, i32, i32) { fn connect(self, sigthis: QHeaderView_sectionResized_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionResized_signal_connect_cb_7 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView14sectionResizedEiii(arg0, arg1, arg2)}; } } impl /* trait */ QHeaderView_sectionResized_signal_connect for Box<Fn(i32, i32, i32)> { fn connect(self, sigthis: QHeaderView_sectionResized_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionResized_signal_connect_cb_box_7 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView14sectionResizedEiii(arg0, arg1, arg2)}; } } // sectionCountChanged(int, int) extern fn QHeaderView_sectionCountChanged_signal_connect_cb_8(rsfptr:fn(i32, i32), arg0: c_int, arg1: c_int) { println!("{}:{}", file!(), line!()); let rsarg0 = arg0 as i32; let rsarg1 = arg1 as i32; rsfptr(rsarg0,rsarg1); } extern fn QHeaderView_sectionCountChanged_signal_connect_cb_box_8(rsfptr_raw:*mut Box<Fn(i32, i32)>, arg0: c_int, arg1: c_int) { println!("{}:{}", file!(), line!()); let rsfptr = unsafe{Box::from_raw(rsfptr_raw)}; let rsarg0 = arg0 as i32; let rsarg1 = arg1 as i32; // rsfptr(rsarg0,rsarg1); unsafe{(*rsfptr_raw)(rsarg0,rsarg1)}; } impl /* trait */ QHeaderView_sectionCountChanged_signal_connect for fn(i32, i32) { fn connect(self, sigthis: QHeaderView_sectionCountChanged_signal) { // do smth... // self as u64; // error for Fn, Ok for fn self as *mut c_void as u64; self as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionCountChanged_signal_connect_cb_8 as *mut c_void; let arg2 = self as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView19sectionCountChangedEii(arg0, arg1, arg2)}; } } impl /* trait */ QHeaderView_sectionCountChanged_signal_connect for Box<Fn(i32, i32)> { fn connect(self, sigthis: QHeaderView_sectionCountChanged_signal) { // do smth... // Box::into_raw(self) as u64; // Box::into_raw(self) as *mut c_void; let arg0 = sigthis.poi as *mut c_void; let arg1 = QHeaderView_sectionCountChanged_signal_connect_cb_box_8 as *mut c_void; let arg2 = Box::into_raw(Box::new(self)) as *mut c_void; unsafe {QHeaderView_SlotProxy_connect__ZN11QHeaderView19sectionCountChangedEii(arg0, arg1, arg2)}; } } // <= body block end
use super::{Chunk, ChunkVec, Heightmap, Vox, VoxType, VoxVec, WorldVec, CHUNK_SIDE}; /// Generates chunks based on a heightmap. #[derive(Clone)] pub struct HeightmapGenerator { /// The limits heightmap: Heightmap, } impl HeightmapGenerator { /// Creates a new heightmap generator. pub fn new(heightmap: Heightmap) -> Self { Self { heightmap } } /// Generates a chunk using the heightmap. /// /// # Arguments /// /// * `vec` - The coordinates of the chunk to generate pub fn generate_chunk(&self, vec: ChunkVec) -> Chunk { let mut chunk = Chunk::new_empty(vec); for y in 0..CHUNK_SIDE { for z in 0..CHUNK_SIDE { for x in 0..CHUNK_SIDE { let vox_vec = VoxVec(x, y, z); let WorldVec(wx, wy, wz) = vec + vox_vec; let value = self.heightmap.value([wx as f32, wy as f32, wz as f32]); chunk[vox_vec] = Vox(if value > 0.0 { VoxType::Stone } else { VoxType::Air }); } } } chunk } }
//! Linux Thread use crate::process::ProcessExt; use crate::signal::{SignalStack, Sigset}; use alloc::sync::Arc; use kernel_hal::user::{Out, UserOutPtr, UserPtr}; use kernel_hal::VirtAddr; use spin::{Mutex, MutexGuard}; use zircon_object::task::{CurrentThread, Process, Thread}; use zircon_object::ZxResult; /// Thread extension for linux pub trait ThreadExt { /// create linux thread fn create_linux(proc: &Arc<Process>) -> ZxResult<Arc<Self>>; /// lock and get Linux thread fn lock_linux(&self) -> MutexGuard<'_, LinuxThread>; /// Set pointer to thread ID. fn set_tid_address(&self, tidptr: UserOutPtr<i32>); } /// CurrentThread extension for linux pub trait CurrentThreadExt { /// exit linux thread fn exit_linux(&self, exit_code: i32); } impl ThreadExt for Thread { fn create_linux(proc: &Arc<Process>) -> ZxResult<Arc<Self>> { let linux_thread = Mutex::new(LinuxThread { clear_child_tid: 0.into(), signal_mask: Sigset::default(), signal_alternate_stack: SignalStack::default(), }); Thread::create_with_ext(proc, "", linux_thread) } fn lock_linux(&self) -> MutexGuard<'_, LinuxThread> { self.ext() .downcast_ref::<Mutex<LinuxThread>>() .unwrap() .lock() } /// Set pointer to thread ID. fn set_tid_address(&self, tidptr: UserPtr<i32, Out>) { self.lock_linux().clear_child_tid = tidptr; } } impl CurrentThreadExt for CurrentThread { /// Exit current thread for Linux. fn exit_linux(&self, _exit_code: i32) { let mut linux_thread = self.lock_linux(); let clear_child_tid = &mut linux_thread.clear_child_tid; // perform futex wake 1 // ref: http://man7.org/linux/man-pages/man2/set_tid_address.2.html if !clear_child_tid.is_null() { info!("exit: do futex {:?} wake 1", clear_child_tid); clear_child_tid.write(0).unwrap(); let uaddr = clear_child_tid.as_ptr() as VirtAddr; let futex = self.proc().linux().get_futex(uaddr); futex.wake(1); } self.exit(); } } /// Linux specific thread information. pub struct LinuxThread { /// Kernel performs futex wake when thread exits. /// Ref: <http://man7.org/linux/man-pages/man2/set_tid_address.2.html> clear_child_tid: UserOutPtr<i32>, /// Signal mask pub signal_mask: Sigset, /// signal alternate stack pub signal_alternate_stack: SignalStack, }
use livesplit_core::{Attempt, Run, RunMetadata, Segment, TimeSpan}; use livesplit_core::run::{parser, saver}; use super::{acc, acc_mut, alloc, output_str, output_time_span, output_vec, own, own_drop, str}; use std::io::Cursor; use std::{ptr, slice}; use libc::c_char; use segment::OwnedSegment; pub type OwnedRun = *mut Run; pub type NullableOwnedRun = *mut Run; #[no_mangle] pub unsafe extern "C" fn Run_new() -> OwnedRun { alloc(Run::new()) } #[no_mangle] pub unsafe extern "C" fn Run_drop(this: OwnedRun) { own_drop(this); } #[no_mangle] pub unsafe extern "C" fn Run_parse(data: *const u8, length: usize) -> NullableOwnedRun { match parser::composite::parse( Cursor::new(slice::from_raw_parts(data, length)), None, false, ) { Ok(run) => alloc(run), Err(_) => ptr::null_mut(), } } #[no_mangle] pub unsafe extern "C" fn Run_clone(this: *const Run) -> OwnedRun { alloc(acc(this).clone()) } #[no_mangle] pub unsafe extern "C" fn Run_push_segment(this: *mut Run, segment: OwnedSegment) { acc_mut(this).push_segment(own(segment)); } #[no_mangle] pub unsafe extern "C" fn Run_game_name(this: *const Run) -> *const c_char { output_str(acc(this).game_name()) } #[no_mangle] pub unsafe extern "C" fn Run_set_game_name(this: *mut Run, game: *const c_char) { acc_mut(this).set_game_name(str(game)); } #[no_mangle] pub unsafe extern "C" fn Run_game_icon(this: *const Run) -> *const c_char { output_str(acc(this).game_icon().url()) } #[no_mangle] pub unsafe extern "C" fn Run_category_name(this: *const Run) -> *const c_char { output_str(acc(this).category_name()) } #[no_mangle] pub unsafe extern "C" fn Run_set_category_name(this: *mut Run, category: *const c_char) { acc_mut(this).set_category_name(str(category)); } #[no_mangle] pub unsafe extern "C" fn Run_extended_file_name( this: *const Run, use_extended_category_name: bool, ) -> *const c_char { output_str(acc(this).extended_file_name(use_extended_category_name)) } #[no_mangle] pub unsafe extern "C" fn Run_extended_name( this: *const Run, use_extended_category_name: bool, ) -> *const c_char { output_str(acc(this).extended_name(use_extended_category_name)) } #[no_mangle] pub unsafe extern "C" fn Run_extended_category_name( this: *const Run, show_region: bool, show_platform: bool, show_variables: bool, ) -> *const c_char { output_str(acc(this).extended_category_name( show_region, show_platform, show_variables, )) } #[no_mangle] pub unsafe extern "C" fn Run_attempt_count(this: *const Run) -> u32 { acc(this).attempt_count() } #[no_mangle] pub unsafe extern "C" fn Run_metadata(this: *const Run) -> *const RunMetadata { acc(this).metadata() } #[no_mangle] pub unsafe extern "C" fn Run_offset(this: *const Run) -> *const TimeSpan { output_time_span(acc(this).offset()) } #[no_mangle] pub unsafe extern "C" fn Run_len(this: *const Run) -> usize { acc(this).len() } #[no_mangle] pub unsafe extern "C" fn Run_segment(this: *const Run, index: usize) -> *const Segment { acc(this).segment(index) } #[no_mangle] pub unsafe extern "C" fn Run_attempt_history_len(this: *const Run) -> usize { acc(this).attempt_history().len() } #[no_mangle] pub unsafe extern "C" fn Run_attempt_history_index( this: *const Run, index: usize, ) -> *const Attempt { &acc(this).attempt_history()[index] } #[no_mangle] pub unsafe extern "C" fn Run_save_as_lss(this: *const Run) -> *const c_char { output_vec(|o| { saver::livesplit::save(acc(this), o).unwrap(); }) }
#![feature(link_args)] use std::sync::{Arc}; use std::thread; use std::env; use std::thread::JoinHandle; #[link_args = "-L./ -lsniper_roi"] #[link(name = "sniper_roi", kind="static")] extern { fn SimRoiStart_wrapper(); } extern { fn SimRoiEnd_wrapper(); } const N: usize = 1048576; fn main() { let args: Vec<String> = env::args().collect(); let THREADS: usize = args[1].parse::<usize>().unwrap(); let mut x: Vec<f64> = vec![0.0; N]; let mut y: Vec<f64> = vec![0.0; N]; init_vecs(&mut x, &mut y); unsafe { SimRoiStart_wrapper(); }; if THREADS==1 { let dotprod = dot_prod(&x, &y, 0, N); println!("{}",dotprod); } else { let x_arc = Arc::new(x); let y_arc = Arc::new(y); let mut handles : Vec<JoinHandle<(f64)>> = Vec::new(); for t in 0..THREADS { let x_shared = x_arc.clone(); let y_shared = y_arc.clone(); let handle = thread::spawn(move || { let start = t *N / THREADS; let mut end = (t+1)*N / THREADS; if t==THREADS-1 { end = N; } let local_sum = dot_prod(&x_shared,&y_shared,start,end); local_sum }); handles.push(handle); } let mut global_sum : f64 = 0.0; for handle in handles { global_sum += handle.join().unwrap(); } println!("{}", global_sum); } unsafe { SimRoiEnd_wrapper(); }; } fn init_vecs(x: &mut Vec<f64>, y: &mut Vec<f64>) { //Initialize so that dot product = N for i in 0..x.len() { x[i] = 4.0; y[i] = 0.25; } } fn dot_prod(x: & Vec<f64>, y: & Vec<f64>, start: usize, end: usize) -> f64 { let mut dotprod: f64 = 0.0; for i in start..end { if i < x.len() { dotprod = dotprod + (x[i] * y[i]); } } dotprod }
use std::ops::{Deref, DerefMut}; use std::{marker, mem, ptr}; use crate::mdb::error::mdb_result; use crate::mdb::ffi; use crate::*; pub struct RoCursor<'txn> { cursor: *mut ffi::MDB_cursor, _marker: marker::PhantomData<&'txn ()>, } impl<'txn> RoCursor<'txn> { pub(crate) fn new<T>(txn: &'txn RoTxn<T>, dbi: ffi::MDB_dbi) -> Result<RoCursor<'txn>> { let mut cursor: *mut ffi::MDB_cursor = ptr::null_mut(); unsafe { mdb_result(ffi::mdb_cursor_open(txn.txn, dbi, &mut cursor))? } Ok(RoCursor { cursor, _marker: marker::PhantomData, }) } pub fn current(&mut self) -> Result<Option<(&'txn [u8], &'txn [u8])>> { let mut key_val = mem::MaybeUninit::uninit(); let mut data_val = mem::MaybeUninit::uninit(); // Move the cursor on the first database key let result = unsafe { mdb_result(ffi::mdb_cursor_get( self.cursor, key_val.as_mut_ptr(), data_val.as_mut_ptr(), ffi::cursor_op::MDB_GET_CURRENT, )) }; match result { Ok(()) => { let key = unsafe { crate::from_val(key_val.assume_init()) }; let data = unsafe { crate::from_val(data_val.assume_init()) }; Ok(Some((key, data))) } Err(e) if e.not_found() => Ok(None), Err(e) => Err(e.into()), } } pub fn move_on_first(&mut self) -> Result<Option<(&'txn [u8], &'txn [u8])>> { let mut key_val = mem::MaybeUninit::uninit(); let mut data_val = mem::MaybeUninit::uninit(); // Move the cursor on the first database key let result = unsafe { mdb_result(ffi::mdb_cursor_get( self.cursor, key_val.as_mut_ptr(), data_val.as_mut_ptr(), ffi::cursor_op::MDB_FIRST, )) }; match result { Ok(()) => { let key = unsafe { crate::from_val(key_val.assume_init()) }; let data = unsafe { crate::from_val(data_val.assume_init()) }; Ok(Some((key, data))) } Err(e) if e.not_found() => Ok(None), Err(e) => Err(e.into()), } } pub fn move_on_last(&mut self) -> Result<Option<(&'txn [u8], &'txn [u8])>> { let mut key_val = mem::MaybeUninit::uninit(); let mut data_val = mem::MaybeUninit::uninit(); // Move the cursor on the first database key let result = unsafe { mdb_result(ffi::mdb_cursor_get( self.cursor, key_val.as_mut_ptr(), data_val.as_mut_ptr(), ffi::cursor_op::MDB_LAST, )) }; match result { Ok(()) => { let key = unsafe { crate::from_val(key_val.assume_init()) }; let data = unsafe { crate::from_val(data_val.assume_init()) }; Ok(Some((key, data))) } Err(e) if e.not_found() => Ok(None), Err(e) => Err(e.into()), } } pub fn move_on_key_greater_than_or_equal_to( &mut self, key: &[u8], ) -> Result<Option<(&'txn [u8], &'txn [u8])>> { let mut key_val = unsafe { crate::into_val(&key) }; let mut data_val = mem::MaybeUninit::uninit(); // Move the cursor to the specified key let result = unsafe { mdb_result(ffi::mdb_cursor_get( self.cursor, &mut key_val, data_val.as_mut_ptr(), ffi::cursor_op::MDB_SET_RANGE, )) }; match result { Ok(()) => { let key = unsafe { crate::from_val(key_val) }; let data = unsafe { crate::from_val(data_val.assume_init()) }; Ok(Some((key, data))) } Err(e) if e.not_found() => Ok(None), Err(e) => Err(e.into()), } } pub fn move_on_prev(&mut self) -> Result<Option<(&'txn [u8], &'txn [u8])>> { let mut key_val = mem::MaybeUninit::uninit(); let mut data_val = mem::MaybeUninit::uninit(); // Move the cursor to the previous non-dup key let result = unsafe { mdb_result(ffi::mdb_cursor_get( self.cursor, key_val.as_mut_ptr(), data_val.as_mut_ptr(), ffi::cursor_op::MDB_PREV, )) }; match result { Ok(()) => { let key = unsafe { crate::from_val(key_val.assume_init()) }; let data = unsafe { crate::from_val(data_val.assume_init()) }; Ok(Some((key, data))) } Err(e) if e.not_found() => Ok(None), Err(e) => Err(e.into()), } } pub fn move_on_next(&mut self) -> Result<Option<(&'txn [u8], &'txn [u8])>> { let mut key_val = mem::MaybeUninit::uninit(); let mut data_val = mem::MaybeUninit::uninit(); // Move the cursor to the next non-dup key let result = unsafe { mdb_result(ffi::mdb_cursor_get( self.cursor, key_val.as_mut_ptr(), data_val.as_mut_ptr(), ffi::cursor_op::MDB_NEXT, )) }; match result { Ok(()) => { let key = unsafe { crate::from_val(key_val.assume_init()) }; let data = unsafe { crate::from_val(data_val.assume_init()) }; Ok(Some((key, data))) } Err(e) if e.not_found() => Ok(None), Err(e) => Err(e.into()), } } } impl Drop for RoCursor<'_> { fn drop(&mut self) { unsafe { ffi::mdb_cursor_close(self.cursor) } } } pub struct RwCursor<'txn> { cursor: RoCursor<'txn>, } impl<'txn> RwCursor<'txn> { pub(crate) fn new<T>(txn: &'txn RwTxn<T>, dbi: ffi::MDB_dbi) -> Result<RwCursor<'txn>> { Ok(RwCursor { cursor: RoCursor::new(txn, dbi)?, }) } /// Delete the entry the cursor is currently pointing to. /// /// Returns `true` if the entry was successfully deleted. /// /// # Safety /// /// It is _[undefined behavior]_ to keep a reference of a value from this database /// while modifying it. /// /// > [Values returned from the database are valid only until a subsequent update operation, /// or the end of the transaction.](http://www.lmdb.tech/doc/group__mdb.html#structMDB__val). /// /// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html pub unsafe fn del_current(&mut self) -> Result<bool> { // Delete the current entry let result = mdb_result(ffi::mdb_cursor_del(self.cursor.cursor, 0)); match result { Ok(()) => Ok(true), Err(e) if e.not_found() => Ok(false), Err(e) => Err(e.into()), } } /// Write a new value to the current entry. /// /// The given key **must** be equal to the one this cursor is pointing otherwise the database /// can be put into an inconsistent state. /// /// Returns `true` if the entry was successfully written. /// /// > This is intended to be used when the new data is the same size as the old. /// > Otherwise it will simply perform a delete of the old record followed by an insert. /// /// # Safety /// /// It is _[undefined behavior]_ to keep a reference of a value from this database while /// modifying it, so you can't use the key/value that comes from the cursor to feed /// this function. /// /// In other words: Tranform the key and value that you borrow from this database into an owned /// version of them i.e. `&str` into `String`. /// /// > [Values returned from the database are valid only until a subsequent update operation, /// or the end of the transaction.](http://www.lmdb.tech/doc/group__mdb.html#structMDB__val). /// /// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html pub unsafe fn put_current(&mut self, key: &[u8], data: &[u8]) -> Result<bool> { let mut key_val = crate::into_val(&key); let mut data_val = crate::into_val(&data); // Modify the pointed data let result = mdb_result(ffi::mdb_cursor_put( self.cursor.cursor, &mut key_val, &mut data_val, ffi::MDB_CURRENT, )); match result { Ok(()) => Ok(true), Err(e) if e.not_found() => Ok(false), Err(e) => Err(e.into()), } } /// Append the given key/value pair to the end of the database. /// /// If a key is inserted that is less than any previous key a `KeyExist` error /// is returned and the key is not inserted into the database. /// /// # Safety /// /// It is _[undefined behavior]_ to keep a reference of a value from this database while /// modifying it, so you can't use the key/value that comes from the cursor to feed /// this function. /// /// In other words: Tranform the key and value that you borrow from this database into an owned /// version of them i.e. `&str` into `String`. /// /// > [Values returned from the database are valid only until a subsequent update operation, /// or the end of the transaction.](http://www.lmdb.tech/doc/group__mdb.html#structMDB__val). /// /// [undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html pub unsafe fn append(&mut self, key: &[u8], data: &[u8]) -> Result<()> { let mut key_val = crate::into_val(&key); let mut data_val = crate::into_val(&data); // Modify the pointed data let result = mdb_result(ffi::mdb_cursor_put( self.cursor.cursor, &mut key_val, &mut data_val, ffi::MDB_APPEND, )); result.map_err(Into::into) } } impl<'txn> Deref for RwCursor<'txn> { type Target = RoCursor<'txn>; fn deref(&self) -> &Self::Target { &self.cursor } } impl DerefMut for RwCursor<'_> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.cursor } }
//============================================================================== // Notes //============================================================================== // drivers::lcd::lcd.rs // LCD Essential Functions //============================================================================== // Crates and Mods //============================================================================== use heapless::Vec; use crate::config; use crate::drivers::log; use crate::mcu::{gpio, spi, spim, timer}; use nrf52832_pac::p0::pin_cnf::DIR_A as DIR; use nrf52832_pac::p0::pin_cnf::PULL_A as PULL; use super::st7789; //============================================================================== // Enums, Structs, and Types //============================================================================== //============================================================================== // Variables //============================================================================== //============================================================================== // Public Functions //============================================================================== pub fn init() { // Initialize lcd control pins gpio::pin_setup(config::LCD_CS_PIN, DIR::OUTPUT, gpio::PinState::PinHigh, PULL::DISABLED); gpio::pin_setup(config::LCD_DCX_PIN, DIR::OUTPUT, gpio::PinState::PinHigh, PULL::DISABLED); gpio::pin_setup(config::LCD_RESET_PIN, DIR::OUTPUT, gpio::PinState::PinLow, PULL::PULLUP); configure(); gpio::pin_setup(config::LCD_BACKLIGHT_LOW, DIR::OUTPUT, gpio::PinState::PinHigh, PULL::DISABLED); gpio::pin_setup(config::LCD_BACKLIGHT_MID, DIR::OUTPUT, gpio::PinState::PinHigh, PULL::DISABLED); gpio::pin_setup(config::LCD_BACKLIGHT_HIGH, DIR::OUTPUT, gpio::PinState::PinHigh, PULL::DISABLED); set_backlight(0); } pub fn set_backlight(backlight: u8) { let mut states: [gpio::PinState; 3] = [gpio::PinState::PinHigh; 3]; for s in 0..3 { states[s] = { if backlight & (1 << s) == 0 { gpio::PinState::PinHigh } else { gpio::PinState::PinLow } }; } gpio::set_pin_state(config::LCD_BACKLIGHT_LOW, states[0]); gpio::set_pin_state(config::LCD_BACKLIGHT_MID, states[1]); gpio::set_pin_state(config::LCD_BACKLIGHT_HIGH, states[2]); } pub fn write_command(command: st7789::COMMAND) { gpio::set_pin_state(config::LCD_CS_PIN, gpio::PinState::PinLow); gpio::set_pin_state(config::LCD_DCX_PIN, gpio::PinState::PinLow); if let Err(_e) = spi::write(&[command as u8]) { log::push_log("Spi command failed"); } gpio::set_pin_state(config::LCD_DCX_PIN, gpio::PinState::PinHigh); gpio::set_pin_state(config::LCD_CS_PIN, gpio::PinState::PinHigh); } pub fn write_data(data: &[u8]) { gpio::set_pin_state(config::LCD_CS_PIN, gpio::PinState::PinLow); gpio::set_pin_state(config::LCD_DCX_PIN, gpio::PinState::PinHigh); if let Err(_e) = spi::write(data) { log::push_log("Spi write data failed"); } gpio::set_pin_state(config::LCD_CS_PIN, gpio::PinState::PinHigh); } pub fn write_block(data: &[u8]) { gpio::set_pin_state(config::LCD_CS_PIN, gpio::PinState::PinLow); gpio::set_pin_state(config::LCD_DCX_PIN, gpio::PinState::PinHigh); let mut bytes_remaining = data.len(); let mut current_index: usize = 0; let mut v: Vec<u8, 255> = Vec::new(); while bytes_remaining > 0 { v.clear(); let bytes_this_transfer = if bytes_remaining > 0xFF { 0xFF } else { bytes_remaining }; if let Ok(()) = v.extend_from_slice( &data[current_index..(current_index + bytes_this_transfer)] ) { if let Err(_e) = spim::write(&v[..bytes_this_transfer]) { log::push_log("Spim write block failed"); break; } } else { break; } current_index += bytes_this_transfer; bytes_remaining -= bytes_this_transfer; } gpio::set_pin_state(config::LCD_CS_PIN, gpio::PinState::PinHigh); } pub fn write_block_solid(color: u16, len: u32) { gpio::set_pin_state(config::LCD_CS_PIN, gpio::PinState::PinLow); gpio::set_pin_state(config::LCD_DCX_PIN, gpio::PinState::PinHigh); let block: [u16; 127] = [color; 127]; let block: [u8; 254] = unsafe { core::mem::transmute::<[u16; 127], [u8; 254]>(block) }; let mut v: Vec<u8, 254> = Vec::new(); let mut remaining = len; if let Ok(()) = v.extend_from_slice(&block[..]) { while remaining > 0 { if remaining > 127 { if let Err(_e) = spim::write(&v[..]) { log::push_log("Spim write solid failed"); } remaining -= 127; } else { let end: usize = (remaining * 2) as usize; if let Err(_e) = spim::write(&v[0..end]) { log::push_log("Spim write solid failed"); } remaining = 0; } } } else { log::push_log("Vec extend failed"); } gpio::set_pin_state(config::LCD_CS_PIN, gpio::PinState::PinHigh); } //============================================================================== // Private Functions //============================================================================== fn configure() { // Enter safe reset sequence gpio::set_pin_state(config::LCD_RESET_PIN, gpio::PinState::PinHigh); timer::delay(5); gpio::set_pin_state(config::LCD_RESET_PIN, gpio::PinState::PinLow); timer::delay(20); gpio::set_pin_state(config::LCD_RESET_PIN, gpio::PinState::PinHigh); timer::delay(150); // Also initiate a software reset - just to be safe write_command(st7789::COMMAND::SW_RESET); timer::delay(150); // Exit sleep write_command(st7789::COMMAND::SLEEP_OUT); timer::delay(150); write_command(st7789::COMMAND::NORMAL_MODE); // Write memory data format: // RGB, left to right, top to bottom, logical direction of memory pointer updates write_command(st7789::COMMAND::MEMORY_DATA_ACCESS_CONTROL); write_data(&mut [ 0x08 ]); // Define pixel interfacing format: // 5-6-5 for 65k color options write_command(st7789::COMMAND::INTERFACE_PIXEL_FORMAT); write_data(&mut [ 0x55 ]); timer::delay(10); write_command(st7789::COMMAND::PORCH_SETTING); write_data(&mut [ 0x0c, 0x0c, 0x00, 0x33, 0x33 ]); write_command(st7789::COMMAND::GATE_CONTROL); write_data(&mut [ 0x35 ]); write_command(st7789::COMMAND::GATE_ON_TIMING_ADJUSTMENT); write_data(&mut [ 0x28 ]); write_command(st7789::COMMAND::LCM_CONTROL); write_data(&mut [ 0x0C ]); write_command(st7789::COMMAND::VDV_VRH_CMD_ENABLE); write_data(&mut [ 0x01, 0xFF ]); write_command(st7789::COMMAND::VRH_SET); write_data(&mut [ 0x01 ]); write_command(st7789::COMMAND::VDV_SET); write_data(&mut [ 0x20 ]); write_command(st7789::COMMAND::FRAME_RATE_CONTROL_2); write_data(&mut [ 0x0F ]); write_command(st7789::COMMAND::POWER_CONTROL_1); write_data(&mut [ 0xA4, 0xA1 ]); write_command(st7789::COMMAND::POSITIVE_VOLTAGE_GAMMA_CONTROL); write_data(&mut [ 0xd0, 0x00, 0x02, 0x07, 0x0a, 0x28, 0x32, 0x44, 0x42, 0x06, 0x0e, 0x12, 0x14, 0x17 ]); write_command(st7789::COMMAND::NEGATIVE_VOLTAGE_GAMMA_CONTROL); write_data(&mut [ 0xd0, 0x00, 0x02, 0x07, 0x0a, 0x28, 0x31, 0x54, 0x47, 0x0e, 0x1c, 0x17, 0x1b, 0x1e ]); write_command(st7789::COMMAND::DISPLAY_INVERSION_ON); write_command(st7789::COMMAND::DISPLAY_BRIGHTNESS); write_data(&mut [ 0x7F ]); //initial 25% brightness write_command(st7789::COMMAND::GAMMA); write_data(&mut [ 0x04 ]); // Explicitly end this bulk write gpio::set_pin_state(config::LCD_CS_PIN, gpio::PinState::PinHigh); timer::delay(120); write_command(st7789::COMMAND::DISPLAY_ON); timer::delay(120); } //============================================================================== // Interrupt Handler //============================================================================== //============================================================================== // Task Handler //==============================================================================
mod aes; use aes::MyCiphers; use rand::{RngCore}; use std::fs; use std::string::String; // This is inefficient. You can set the plaintext to the ciphertext, // then CTR will decrypt it for you! pub fn crack_random_access_ctr(cipher: &MyCiphers, ct: &mut [u8], nonce: u64) -> Vec<u8> { let mut cracked = vec!(); for i in 0..ct.len() { let target = ct[i].clone(); for guess in 0..255u8 { cipher.edit(ct, nonce, i, &[guess]); if target == ct[i] { cracked.extend_from_slice(&[guess]); break; } } } return cracked; } pub fn get_ct(cipher: &MyCiphers, nonce: u64) -> Vec<u8> { let default_cipher = MyCiphers::init_default(); let encoded_ct = fs::read_to_string("src/files/s4c25").expect("Can't read file."); let trimmed: String = encoded_ct.chars() .filter(|c| *c != '\n') .collect(); let decoded_ct = base64::decode(&trimmed).expect("Can't decode file"); let pt = default_cipher.decrypt_ecb(&decoded_ct); cipher.xcrypt_ctr(&pt, nonce) } pub fn main() { let mut rng = rand::thread_rng(); let nonce: u64 = rng.next_u64(); let mut key_bytes: [u8;16] = [0; 16]; rng.fill_bytes(&mut key_bytes); let key = key_bytes.to_vec(); let c = MyCiphers::init(key); let mut ct = get_ct(&c, nonce); let ct_clone = ct.clone(); let result = c.edit(&mut ct, nonce, 0, &ct_clone); println!("{}", String::from_utf8_lossy(&result)); }
fn main() { let u = {x: 10, y: @{a: 20}}; let {x, y: @{a}} = u; x = 100; a = 100; assert x == 100; assert a == 100; assert u.x == 10; assert u.y.a == 20; }
use super::import_map::*; use camino::Utf8Path; use hyper::body::Bytes; use lol_html::{element, html_content::ContentType, text, HtmlRewriter, Settings}; use serde_json as json; use std::{fs, time::UNIX_EPOCH}; pub fn rewrite_assets(bytes: Bytes, mut output: Vec<u8>) -> anyhow::Result<Vec<u8>> { let mut rewriter = HtmlRewriter::new( Settings { element_content_handlers: vec![ element!("link[href]", |el| { if let Some(href) = el.get_attribute("href") { el.set_attribute("href", asset_url(href.to_string()).as_str()) .ok(); } Ok(()) }), element!("script[src]", |el| { if let Some(src) = el.get_attribute("src") { el.set_attribute("src", asset_url(src.to_string()).as_str()) .ok(); } Ok(()) }), text!("script[type='importmap']", |el| { if let Ok(mut import_map) = json::from_str::<ImportMap>(el.as_str()) { import_map.map(asset_url); el.replace( json::to_string(&import_map).unwrap().as_str(), ContentType::Text, ); } Ok(()) }), ], ..Default::default() }, |c: &[u8]| output.extend_from_slice(c), ); rewriter.write(bytes.as_ref())?; rewriter.end()?; Ok(output) } fn asset_url(mut url: String) -> String { if url.starts_with('/') { if let Ok(time) = fs::metadata(Utf8Path::new("theme").join(&url[1..])).and_then(|meta| meta.modified()) { let version_time = time .duration_since(UNIX_EPOCH) .map(|d| d.as_secs()) .expect("time should be a valid time since the unix epoch"); let cache_key = base62::encode(version_time); let path = Utf8Path::new(&url); let ext = path.extension().unwrap_or_default(); url = path .with_extension(format!("{cache_key}.{ext}")) .to_string(); } }; url }
use common::aoc::{load_input, run_many, print_time, print_result}; use common::intcode::VM; fn main() { let input = load_input("day09"); let (vm, dur_parse) = run_many(10000, || VM::parse(input.trim_end_matches('\n'))); let (res_part1, dur_part1) = run_many(10000, || part1(&mut vm.clone())); let (res_part2, dur_part2) = run_many(300, || part2(&mut vm.clone())); print_result("P1", res_part1); print_result("P2", res_part2); print_time("Parse", dur_parse); print_time("P1", dur_part1); print_time("P2", dur_part2); } fn part1(vm: &mut VM) -> i64 { vm.push_input(1); vm.run(); if vm.output().len() > 1 { panic!("[BOOST] check opcode: {:?}", vm.output()) } *vm.output().first().unwrap() } fn part2(vm: &mut VM) -> i64 { vm.push_input(2); vm.run(); *vm.output().first().unwrap() }
use std::{ thread::sleep, time::Duration, collections::BTreeMap, process::exit, path::{PathBuf, Component}, env::current_exe, io::{stdin, stdout, Write}, fs::{read_to_string, write} }; use super::{Value, Error, VERSION, PRELUDE_FILENAME}; use rand::{seq::SliceRandom, Rng, thread_rng, distributions::Uniform}; use chrono::{Local, Timelike, Datelike}; use os_info::Type; use asciicolor::Colorize; use lazy_static::lazy_static; lazy_static! { static ref SPADES: Vec<Value> = { vec![ Value::string("🂡"), Value::string("🂢"), Value::string("🂣"), Value::string("🂤"), Value::string("🂥"), Value::string("🂦"), Value::string("🂧"), Value::string("🂨"), Value::string("🂩"), Value::string("🂪"), Value::string("🂫"), Value::string("🂭"), Value::string("🂮") ] }; static ref HEARTS: Vec<Value> = { vec![ Value::string("🂱"), Value::string("🂲"), Value::string("🂳"), Value::string("🂴"), Value::string("🂵"), Value::string("🂶"), Value::string("🂷"), Value::string("🂸"), Value::string("🂹"), Value::string("🂺"), Value::string("🂻"), Value::string("🂽"), Value::string("🂾") ] }; static ref DIAMONDS: Vec<Value> = { vec![ Value::string("🃁"), Value::string("🃂"), Value::string("🃃"), Value::string("🃄"), Value::string("🃅"), Value::string("🃆"), Value::string("🃇"), Value::string("🃈"), Value::string("🃉"), Value::string("🃊"), Value::string("🃋"), Value::string("🃍"), Value::string("🃎") ] }; static ref CLUBS: Vec<Value> = { vec![ Value::string("🃑"), Value::string("🃒"), Value::string("🃓"), Value::string("🃔"), Value::string("🃕"), Value::string("🃖"), Value::string("🃗"), Value::string("🃘"), Value::string("🃙"), Value::string("🃚"), Value::string("🃛"), Value::string("🃝"), Value::string("🃞") ] }; static ref CARDS: Value = { let mut cards = BTreeMap::new(); let mut deck = BTreeMap::new(); deck.insert("all".to_string(), Value::List(vec![ Value::string("🂡"), Value::string("🂱"), Value::string("🃁"), Value::string("🃑"), Value::string("🂢"), Value::string("🂲"), Value::string("🃂"), Value::string("🃒"), Value::string("🂣"), Value::string("🂳"), Value::string("🃃"), Value::string("🃓"), Value::string("🂤"), Value::string("🂴"), Value::string("🃄"), Value::string("🃔"), Value::string("🂥"), Value::string("🂵"), Value::string("🃅"), Value::string("🃕"), Value::string("🂦"), Value::string("🂶"), Value::string("🃆"), Value::string("🃖"), Value::string("🂧"), Value::string("🂷"), Value::string("🃇"), Value::string("🃗"), Value::string("🂨"), Value::string("🂸"), Value::string("🃈"), Value::string("🃘"), Value::string("🂩"), Value::string("🂹"), Value::string("🃉"), Value::string("🃙"), Value::string("🂪"), Value::string("🂺"), Value::string("🃊"), Value::string("🃚"), Value::string("🂫"), Value::string("🂻"), Value::string("🃋"), Value::string("🃛"), Value::string("🂭"), Value::string("🂽"), Value::string("🃍"), Value::string("🃝"), Value::string("🂮"), Value::string("🂾"), Value::string("🃎"), Value::string("🃞"), ])); deck.insert("aces".to_string(), Value::List(vec![ Value::string("🂡"), Value::string("🂱"), Value::string("🃁"), Value::string("🃑"), ])); deck.insert("kings".to_string(), Value::List(vec![ Value::string("🂮"), Value::string("🂾"), Value::string("🃎"), Value::string("🃞"), ])); deck.insert("queens".to_string(), Value::List(vec![ Value::string("🂭"), Value::string("🂽"), Value::string("🃍"), Value::string("🃝"), ])); deck.insert("jacks".to_string(), Value::List(vec![ Value::string("🂫"), Value::string("🂻"), Value::string("🃋"), Value::string("🃛"), ])); deck.insert("faces".to_string(), Value::List(vec![ Value::string("🂫"), Value::string("🂻"), Value::string("🃋"), Value::string("🃛"), Value::string("🂭"), Value::string("🂽"), Value::string("🃍"), Value::string("🃝"), Value::string("🂮"), Value::string("🂾"), Value::string("🃎"), Value::string("🃞"), ])); deck.insert("numbers".to_string(), Value::List(vec![ Value::string("🂢"), Value::string("🂲"), Value::string("🃂"), Value::string("🃒"), Value::string("🂣"), Value::string("🂳"), Value::string("🃃"), Value::string("🃓"), Value::string("🂤"), Value::string("🂴"), Value::string("🃄"), Value::string("🃔"), Value::string("🂥"), Value::string("🂵"), Value::string("🃅"), Value::string("🃕"), Value::string("🂦"), Value::string("🂶"), Value::string("🃆"), Value::string("🃖"), Value::string("🂧"), Value::string("🂷"), Value::string("🃇"), Value::string("🃗"), Value::string("🂨"), Value::string("🂸"), Value::string("🃈"), Value::string("🃘"), Value::string("🂩"), Value::string("🂹"), Value::string("🃉"), Value::string("🃙"), Value::string("🂪"), Value::string("🂺"), Value::string("🃊"), Value::string("🃚"), ])); deck.insert("spades".to_string(), Value::List(SPADES.clone())); deck.insert("hearts".to_string(), Value::List(HEARTS.clone())); deck.insert("diamonds".to_string(), Value::List(DIAMONDS.clone())); deck.insert("clubs".to_string(), Value::List(CLUBS.clone())); cards.insert("deck".to_string(), Value::Table(deck)); let mut suites = BTreeMap::new(); suites.insert("spades".to_string(), Value::string("♠")); suites.insert("clubs".to_string(), Value::string("♣")); suites.insert("hearts".to_string(), Value::string("♥")); suites.insert("diamonds".to_string(), Value::string("♦")); cards.insert("suites".to_string(), Value::Table(suites)); cards.insert("suite".to_string(), Value::builtin("cards@suite", |args, env| { check_args_len(Value::symbol("cards@suite"), &args, 1)?; let card = args[0].eval(env)?; Ok(if SPADES.contains(&card) { Value::string("♠") } else if HEARTS.contains(&card) { Value::string("♥") } else if DIAMONDS.contains(&card) { Value::string("♦") } else if CLUBS.contains(&card) { Value::string("♣") } else { return Err(Error::CustomError(format!("{} does not belong to any suite", card))) }) })); fn value(card: &Value) -> Result<i32, Error> { if let Some(i) = SPADES.iter().position(|x| x.clone() == card.clone()) { Ok((i + 1) as i32) } else if let Some(i) = HEARTS.iter().position(|x| x.clone() == card.clone()) { Ok((i + 1) as i32) } else if let Some(i) = DIAMONDS.iter().position(|x| x.clone() == card.clone()) { Ok((i + 1) as i32) } else if let Some(i) = CLUBS.iter().position(|x| x.clone() == card.clone()) { Ok((i + 1) as i32) } else { return Err(Error::CustomError(format!("{} does not belong to any suite", card))) } } cards.insert("value".to_string(), Value::builtin("cards@value", |args, env| { check_args_len(Value::symbol("cards@value"), &args, 1)?; let card = args[0].eval(env)?; Ok(Value::Integer(value(&card)?)) })); cards.insert("name".to_string(), Value::builtin("cards@name", |args, env| { check_args_len(Value::symbol("cards@name"), &args, 1)?; let card = args[0].eval(env)?; Ok(Value::string( format!("{} of {}", match value(&card)? { 1 => "ace", 2 => "two", 3 => "three", 4 => "four", 5 => "five", 6 => "six", 7 => "seven", 8 => "eight", 9 => "nine", 10 => "ten", 11 => "jack", 12 => "queen", 13 => "king", _ => return Err(Error::CustomError(format!("invalid card value for {}", card))) }, if SPADES.contains(&card) { "spades" } else if HEARTS.contains(&card) { "hearts" } else if DIAMONDS.contains(&card) { "diamonds" } else if CLUBS.contains(&card) { "clubs" } else { return Err(Error::CustomError(format!("{} does not belong to any suite", card))) } ) )) })); cards.insert("from-name".to_string(), Value::builtin("cards@from-name", |args, env| { check_args_len(Value::symbol("cards@from-name"), &args, 1)?; let name = args[0].eval(env)?.to_string(); let words = name.trim().split_whitespace().map(ToString::to_string).collect::<Vec<String>>(); if words.len() != 3 || words[1] != "of" { return Err(Error::CustomError(format!("\"{}\" is not a valid card name", name))) } let val = match words[0].as_str() { "ace" => 1, "two" | "2" => 2, "three" | "3" => 3, "four" | "4" => 4, "five" | "5" => 5, "six" | "6" => 6, "seven" | "7" => 7, "eight" | "8" => 8, "nine" | "9" => 9, "ten" | "10" => 10, "jack" => 11, "queen" => 12, "king" => 13, e => return Err(Error::CustomError(format!("invalid card value \"{}\"", e))) }; let suite = match words[2].as_str() { "spades" => SPADES.clone(), "hearts" => HEARTS.clone(), "diamonds" => DIAMONDS.clone(), "clubs" => CLUBS.clone(), e => return Err(Error::CustomError(format!("invalid card suite \"{}\"", e))) }; Ok(Value::string(suite[val-1].clone())) })); cards.insert("back".to_string(), Value::string("🂠")); Value::Table(cards) }; static ref CHESS: Value = { let mut chess = BTreeMap::new(); let mut white = BTreeMap::new(); let mut black = BTreeMap::new(); white.insert("king".to_string(), Value::string("♔")); white.insert("queen".to_string(), Value::string("♕")); white.insert("rook".to_string(), Value::string("♖")); white.insert("bishop".to_string(), Value::string("♗")); white.insert("knight".to_string(), Value::string("♘")); white.insert("pawn".to_string(), Value::string("♙")); chess.insert("white".to_string(), Value::Table(white)); black.insert("king".to_string(), Value::string("♚")); black.insert("queen".to_string(), Value::string("♛")); black.insert("rook".to_string(), Value::string("♜")); black.insert("bishop".to_string(), Value::string("♝")); black.insert("knight".to_string(), Value::string("♞")); black.insert("pawn".to_string(), Value::string("♟")); chess.insert("black".to_string(), Value::Table(black)); chess.insert("space".to_string(), Value::string(".")); fn is_piece(piece: &String) -> bool { ["♚", "♛", "♜", "♝", "♞", "♟", "♔", "♕", "♖", "♗", "♘", "♙"].contains(&piece.as_str()) } fn is_white(piece: &String) -> bool { ["♔", "♕", "♖", "♗", "♘", "♙"].contains(&piece.as_str()) } fn is_black(piece: &String) -> bool { ["♚", "♛", "♜", "♝", "♞", "♟"].contains(&piece.as_str()) } fn is_space(piece: &String) -> bool { !is_piece(piece) } chess.insert("is-piece".to_string(), Value::builtin("chess@is-piece", |args, env| { check_args_len(Value::Symbol("chess@is-piece".to_string()), &args, 1)?; if let Value::String(piece) = args[0].eval(env)? { Ok(Value::Boolean(is_piece(&piece))) } else { Err(Error::InvalidArguments(Value::Symbol("chess@is-piece".to_string()), args.clone())) } })); chess.insert("is-space".to_string(), Value::builtin("chess@is-space", |args, env| { check_args_len(Value::Symbol("chess@is-space".to_string()), &args, 1)?; if let Value::String(piece) = args[0].eval(env)? { Ok(Value::Boolean(is_space(&piece))) } else { Err(Error::InvalidArguments(Value::Symbol("chess@is-space".to_string()), args.clone())) } })); chess.insert("is-white".to_string(), Value::builtin("chess@is-white", |args, env| { check_args_len(Value::Symbol("chess@is-white".to_string()), &args, 1)?; if let Value::String(piece) = args[0].eval(env)? { Ok(Value::Boolean(is_white(&piece))) } else { Err(Error::InvalidArguments(Value::Symbol("chess@is-white".to_string()), args.clone())) } })); chess.insert("is-black".to_string(), Value::builtin("chess@is-black", |args, env| { check_args_len(Value::Symbol("chess@is-black".to_string()), &args, 1)?; if let Value::String(piece) = args[0].eval(env)? { Ok(Value::Boolean(is_black(&piece))) } else { Err(Error::InvalidArguments(Value::Symbol("chess@is-black".to_string()), args.clone())) } })); chess.insert("create".to_string(), Value::builtin("chess@create", |args, _| { check_args_len(Value::symbol("chess@create"), &args, 0)?; Ok(Value::List(vec![ Value::List(["♜", "♞", "♝", "♛", "♚", "♝", "♞", "♜"].iter().map(Value::string).collect()), Value::List(vec!["♟"].repeat(8).iter().map(Value::string).collect()), Value::List(vec!["."].repeat(8).iter().map(Value::string).collect()), Value::List(vec!["."].repeat(8).iter().map(Value::string).collect()), Value::List(vec!["."].repeat(8).iter().map(Value::string).collect()), Value::List(vec!["."].repeat(8).iter().map(Value::string).collect()), Value::List(vec!["♙"].repeat(8).iter().map(Value::string).collect()), Value::List(["♖", "♘", "♗", "♕", "♔", "♗", "♘", "♖"].iter().map(Value::string).collect()), ])) })); chess.insert("flip".to_string(), Value::builtin("chess@flip", |args, env| { check_args_len(Value::symbol("chess@flip"), &args, 1)?; if let Value::List(mut board) = args[0].eval(env)? { board.reverse(); Ok(Value::List(board)) } else { Err(Error::InvalidArguments(Value::symbol("chess@flip"), args.clone())) } })); fn get(board: Vec<Vec<Value>>, col: usize, row: usize) -> Value { board[row][col].clone() } fn to_coords(pos: &String) -> Result<(usize, usize), Error> { let tmp = pos.trim().to_lowercase(); let mut chars = tmp.chars(); if let Some(col) = chars.next() { if let Some(row) = chars.next() { if chars.next() == None { Ok((match col { 'a' => 0, 'b' => 1, 'c' => 2, 'd' => 3, 'e' => 4, 'f' => 5, 'g' => 6, 'h' => 7, _ => return Err(Error::CustomError(format!("invalid notation for piece position `{}`", pos))) }, match row.to_string().parse::<usize>() { Ok(n) if 1 <= 1 && n <= 8 => 8 - n, _ => return Err(Error::CustomError(format!("invalid notation for piece position `{}`", pos))) })) } else { Err(Error::CustomError(format!("invalid notation for piece position `{}`", pos))) } } else { Err(Error::CustomError(format!("invalid notation for piece position `{}`", pos))) } } else { Err(Error::CustomError(format!("invalid notation for piece position `{}`", pos))) } } chess.insert("get".to_string(), Value::builtin("chess@get", |args, env| { check_args_len(Value::symbol("chess@get"), &args, 2)?; match (args[0].eval(env)?, args[1].eval(env)?) { (Value::List(val_board), Value::String(pos)) => { let mut board = vec![]; for val_row in val_board { if let Value::List(row) = val_row { board.push(row); } else { return Err(Error::InvalidArguments(Value::Symbol("chess@get".to_string()), args.clone())) } } let (col, row) = to_coords(&pos)?; Ok(get(board, col, row)) } _ => Err(Error::InvalidArguments(Value::Symbol("chess@get".to_string()), args.clone())) } })); fn to_board(val_board: Vec<Value>) -> Result<Vec<Vec<Value>>, Error> { let mut board = vec![]; for val_row in val_board { if let Value::List(row) = val_row { board.push(row); } else { return Err(Error::CustomError("malformed board".to_string())) } } Ok(board) } fn format_board(val_board: Vec<Value>) -> Result<Value, Error> { let mut result = String::new(); let board = to_board(val_board)?; let mut is_black = false; for (i, row) in board.iter().enumerate() { for col in row { result += &if is_black && is_space(&col.to_string()) { "░".to_string() } else if !is_black && is_space(&col.to_string()) { " ".to_string() } else { format!("{}", col) }; is_black = !is_black } is_black = !is_black; if i+1 < 8 { result.push('\n') } } Ok(Value::String(result)) } chess.insert("fmt".to_string(), Value::builtin("chess@fmt", |args, env| { check_args_len(Value::symbol("chess@fmt"), &args, 1)?; match args[0].eval(env)? { Value::List(val_board) => format_board(val_board), _ => Err(Error::InvalidArguments(Value::Symbol("chess@fmt".to_string()), args.clone())) } })); chess.insert("print".to_string(), Value::builtin("chess@print", |args, env| { check_args_len(Value::symbol("chess@print"), &args, 1)?; match args[0].eval(env)? { Value::List(val_board) => { println!("{}", format_board(val_board)?); Ok(Value::Nil) } _ => Err(Error::InvalidArguments(Value::Symbol("chess@print".to_string()), args.clone())) } })); chess.insert("mv".to_string(), Value::builtin("chess@mv", |args, env| { check_args_len(Value::symbol("chess@mv"), &args, 3)?; match (args[0].eval(env)?, args[1].eval(env)?, args[2].eval(env)?) { (Value::List(val_board), Value::String(from), Value::String(to)) => { let mut board = to_board(val_board)?; let (src_col, src_row) = to_coords(&from)?; let (dst_col, dst_row) = to_coords(&to)?; let src_piece = &board[src_row][src_col].to_string(); let dst_piece = &board[dst_row][dst_col].to_string(); if is_piece(&src_piece) { if (is_white(&src_piece) != is_white(&dst_piece)) || is_space(&dst_piece) { board[dst_row][dst_col] = board[src_row][src_col].clone(); board[src_row][src_col] = Value::string("."); Ok(Value::List(board.iter().map(|x| Value::List(x.clone())).collect())) } else { Err(Error::CustomError("cannot capture same color piece".to_string())) } } else { Err(Error::CustomError("cannot move non-piece".to_string())) } } _ => Err(Error::InvalidArguments(Value::Symbol("chess@mv".to_string()), args.clone())) } })); chess.insert("add".to_string(), Value::builtin("chess@add", |args, env| { check_args_len(Value::symbol("chess@add"), &args, 3)?; match (args[0].eval(env)?, args[1].eval(env)?, args[2].eval(env)?) { (Value::List(val_board), Value::String(dst), Value::String(piece)) => { let mut board = to_board(val_board)?; let (dst_col, dst_row) = to_coords(&dst)?; board[dst_row][dst_col] = Value::String(piece); Ok(Value::List(board.iter().map(|x| Value::List(x.clone())).collect())) } _ => Err(Error::InvalidArguments(Value::Symbol("chess@add".to_string()), args.clone())) } })); chess.insert("rm".to_string(), Value::builtin("chess@rm", |args, env| { check_args_len(Value::symbol("chess@rm"), &args, 2)?; match (args[0].eval(env)?, args[1].eval(env)?) { (Value::List(val_board), Value::String(rm)) => { let mut board = to_board(val_board)?; let (rm_col, rm_row) = to_coords(&rm)?; board[rm_row][rm_col] = Value::string("."); Ok(Value::List(board.iter().map(|x| Value::List(x.clone())).collect())) } _ => Err(Error::InvalidArguments(Value::Symbol("chess@rm".to_string()), args.clone())) } })); Value::Table(chess) }; static ref FMT: Value = { let mut colorize = BTreeMap::new(); let mut dark = BTreeMap::new(); macro_rules! make_color { ($color:expr) => {|args, env| { let mut result = String::new(); for (i, arg) in args.iter().enumerate() { result += &format!("{}", arg.eval(env)?); if i < args.len()-1 { result += " "; } } Ok(Value::String($color(result))) }}; } dark.insert(String::from("red"), Value::builtin("fmt@dark@red", make_color!(Colorize::red))); dark.insert(String::from("green"), Value::builtin("fmt@dark@green", make_color!(Colorize::green))); dark.insert(String::from("blue"), Value::builtin("fmt@dark@blue", make_color!(Colorize::blue))); dark.insert(String::from("cyan"), Value::builtin("fmt@dark@cyan", make_color!(Colorize::cyan))); dark.insert(String::from("yellow"), Value::builtin("fmt@dark@yellow", make_color!(Colorize::yellow))); dark.insert(String::from("magenta"), Value::builtin("fmt@dark@magenta", make_color!(Colorize::magenta))); colorize.insert(String::from("dark"), Value::Table(dark)); colorize.insert(String::from("red"), Value::builtin("fmt@red", make_color!(Colorize::bright_red))); colorize.insert(String::from("green"), Value::builtin("fmt@green", make_color!(Colorize::bright_green))); colorize.insert(String::from("blue"), Value::builtin("fmt@blue", make_color!(Colorize::bright_blue))); colorize.insert(String::from("yellow"), Value::builtin("fmt@yellow", make_color!(Colorize::bright_yellow))); colorize.insert(String::from("magenta"), Value::builtin("fmt@magenta", make_color!(Colorize::bright_magenta))); colorize.insert(String::from("cyan"), Value::builtin("fmt@cyan", make_color!(Colorize::bright_cyan))); colorize.insert(String::from("black"), Value::builtin("fmt@black", make_color!(Colorize::black))); colorize.insert(String::from("gray"), Value::builtin("fmt@gray", make_color!(Colorize::bright_black))); colorize.insert(String::from("grey"), Value::builtin("fmt@grey", make_color!(Colorize::bright_black))); colorize.insert(String::from("white"), Value::builtin("fmt@white", make_color!(Colorize::bright_white))); colorize.insert(String::from("bold"), Value::builtin("fmt@bold", make_color!(Colorize::bold))); colorize.insert(String::from("invert"), Value::builtin("fmt@invert", make_color!(Colorize::invert))); colorize.insert(String::from("underline"), Value::builtin("fmt@underline", make_color!(Colorize::underline))); Value::Table(colorize) }; static ref MATH: Value = { let mut math = BTreeMap::new(); math.insert("E".to_string(), Value::Float(std::f64::consts::E)); math.insert("PI".to_string(), Value::Float(std::f64::consts::PI)); math.insert("TAU".to_string(), Value::Float(std::f64::consts::TAU)); math.insert("pow".to_string(), Value::builtin("pow", |args, env| { check_args_len(Value::symbol("math@pow"), &args, 2)?; match args[0].eval(env)? { Value::Float(base) => { match args[1].eval(env)? { Value::Float(n) => Ok(Value::Float(base.powf(n))), Value::Integer(n) => Ok(Value::Float(base.powi(n))), _ => Err(Error::InvalidArguments(Value::symbol("math@pow"), args.clone())) } } Value::Integer(base) => { match args[1].eval(env)? { Value::Float(n) => Ok(Value::Float((base as f64).powf(n))), Value::Integer(n) if n > 0 => Ok(Value::Integer(base.pow(n as u32))), Value::Integer(n) => Ok(Value::Float((base as f64).powi(n))), _ => Err(Error::InvalidArguments(Value::symbol("math@pow"), args.clone())) } } _ => Err(Error::InvalidArguments(Value::symbol("math@pow"), args.clone())) } })); math.insert("log".to_string(), Value::builtin("log", |args, env| { check_args_len(Value::symbol("math@log"), &args, 2)?; let base = match args[0].eval(env)? { Value::Float(n) => Ok(n), Value::Integer(n) => Ok(n as f64), _ => Err(Error::InvalidArguments(Value::symbol("math@log"), args.clone())) }?; let x = match args[1].eval(env)? { Value::Float(n) => Ok(n), Value::Integer(n) => Ok(n as f64), _ => Err(Error::InvalidArguments(Value::symbol("math@log"), args.clone())) }?; Ok(Value::Float(x.log(base))) })); math.insert("log10".to_string(), Value::builtin("log10", |args, env| { check_args_len(Value::symbol("math@log10"), &args, 1)?; let x = match args[0].eval(env)? { Value::Float(n) => Ok(n), Value::Integer(n) => Ok(n as f64), _ => Err(Error::InvalidArguments(Value::symbol("math@log10"), args.clone())) }?; Ok(Value::Float(x.log10())) })); math.insert("log2".to_string(), Value::builtin("log2", |args, env| { check_args_len(Value::symbol("math@log2"), &args, 1)?; let x = match args[0].eval(env)? { Value::Float(n) => Ok(n), Value::Integer(n) => Ok(n as f64), _ => Err(Error::InvalidArguments(Value::symbol("math@log2"), args.clone())) }?; Ok(Value::Float(x.log2())) })); math.insert("sqrt".to_string(), Value::builtin("sqrt", |args, env| { check_args_len(Value::symbol("math@sqrt"), &args, 1)?; match args[0].eval(env)? { Value::Float(n) => Ok(Value::Float(n.sqrt())), Value::Integer(n) => Ok(Value::Float((n as f64).sqrt())), _ => Err(Error::InvalidArguments(Value::symbol("math@sqrt"), args.clone())) } })); math.insert("cbrt".to_string(), Value::builtin("cbrt", |args, env| { check_args_len(Value::symbol("math@cbrt"), &args, 1)?; match args[0].eval(env)? { Value::Float(n) => Ok(Value::Float(n.cbrt())), Value::Integer(n) => Ok(Value::Float((n as f64).cbrt())), _ => Err(Error::InvalidArguments(Value::symbol("math@cbrt"), args.clone())) } })); math.insert("sin".to_string(), Value::builtin("sin", |args, env| { check_args_len(Value::symbol("math@sin"), &args, 1)?; match args[0].eval(env)? { Value::Float(n) => Ok(Value::Float(n.sin())), Value::Integer(n) => Ok(Value::Float((n as f64).sin())), _ => Err(Error::InvalidArguments(Value::symbol("math@sin"), args.clone())) } })); math.insert("cos".to_string(), Value::builtin("cos", |args, env| { check_args_len(Value::symbol("math@cos"), &args, 1)?; match args[0].eval(env)? { Value::Float(n) => Ok(Value::Float(n.cos())), Value::Integer(n) => Ok(Value::Float((n as f64).cos())), _ => Err(Error::InvalidArguments(Value::symbol("math@cos"), args.clone())) } })); math.insert("tan".to_string(), Value::builtin("tan", |args, env| { check_args_len(Value::symbol("math@tan"), &args, 1)?; match args[0].eval(env)? { Value::Float(n) => Ok(Value::Float(n.tan())), Value::Integer(n) => Ok(Value::Float((n as f64).tan())), _ => Err(Error::InvalidArguments(Value::symbol("math@tan"), args.clone())) } })); math.insert("asin".to_string(), Value::builtin("asin", |args, env| { check_args_len(Value::symbol("math@asin"), &args, 1)?; match args[0].eval(env)? { Value::Float(n) => Ok(Value::Float(n.asin())), Value::Integer(n) => Ok(Value::Float((n as f64).asin())), _ => Err(Error::InvalidArguments(Value::symbol("math@asin"), args.clone())) } })); math.insert("acos".to_string(), Value::builtin("acos", |args, env| { check_args_len(Value::symbol("math@acos"), &args, 1)?; match args[0].eval(env)? { Value::Float(n) => Ok(Value::Float(n.acos())), Value::Integer(n) => Ok(Value::Float((n as f64).acos())), _ => Err(Error::InvalidArguments(Value::symbol("math@acos"), args.clone())) } })); math.insert("atan".to_string(), Value::builtin("atan", |args, env| { check_args_len(Value::symbol("math@atan"), &args, 1)?; match args[0].eval(env)? { Value::Float(n) => Ok(Value::Float(n.atan())), Value::Integer(n) => Ok(Value::Float((n as f64).atan())), _ => Err(Error::InvalidArguments(Value::symbol("math@atan"), args.clone())) } })); Value::Table(math) }; } #[derive(Clone)] pub struct Environment { symbols: BTreeMap<String, Value> } const TYPES: &'static [Type] = &[ Type::Alpine, Type::Amazon, Type::Android, Type::Arch, Type::CentOS, Type::Debian, Type::Emscripten, Type::EndeavourOS, Type::Fedora, Type::Linux, Type::Macos, Type::Manjaro, Type::Mint, Type::openSUSE, Type::OracleLinux, Type::Pop, Type::Redhat, Type::RedHatEnterprise, Type::Redox, Type::Solus, Type::SUSE, Type::Ubuntu, Type::Unknown, Type::Windows ]; fn get_os_name(t: &Type) -> String { match t { Type::Alpine => "alpine", Type::Amazon => "amazon", Type::Android => "android", Type::Arch => "arch", Type::CentOS => "centos", Type::Debian => "debian", Type::Macos => "macos", Type::Fedora => "fedora", Type::Linux => "linux", Type::Manjaro => "manjaro", Type::Mint => "mint", Type::openSUSE => "opensuse", Type::EndeavourOS => "endeavouros", Type::OracleLinux => "oraclelinux", Type::Pop => "pop", Type::Redhat => "redhat", Type::RedHatEnterprise => "redhatenterprise", Type::Redox => "redox", Type::Solus => "solus", Type::SUSE => "suse", Type::Ubuntu => "ubuntu", Type::Windows => "windows", Type::Unknown | _ => "unknown", }.to_string() } fn get_os_family(t: &Type) -> String { match t { Type::Amazon | Type::Android => "android", Type::Alpine | Type::Arch | Type::CentOS | Type::Debian | Type::Fedora | Type::Linux | Type::Manjaro | Type::Mint | Type::openSUSE | Type::EndeavourOS | Type::OracleLinux | Type::Pop | Type::Redhat | Type::RedHatEnterprise | Type::SUSE | Type::Ubuntu => "linux", Type::Macos | Type::Solus | Type::Redox => "unix", Type::Windows => "windows", Type::Unknown | _ => "unknown", }.to_string() } pub const REPORT: &str = "report"; pub const PROMPT: &str = "prompt"; pub const INCOMPLETE_PROMPT: &str = "incomplete-prompt"; pub const CWD: &str = "CWD"; const HOME: &str = "HOME"; const VIDEOS: &str = "VIDS"; const DESKTOP: &str = "DESK"; const PICTURES: &str = "PICS"; const DOCUMENTS: &str = "DOCS"; const DOWNLOADS: &str = "DOWN"; fn check_args_len(func: Value, args: &Vec<Value>, len: usize) -> Result<(), Error> { if args.len() > len { Err(Error::TooManyArguments(func, args.clone())) } else if args.len() < len { Err(Error::TooFewArguments(func, args.clone())) } else { Ok(()) } } impl Environment { pub fn new() -> Self { let mut result = Self { symbols: BTreeMap::new() }; result.define(CWD, Value::Path(if let Ok(path) = result.get_cwd() { path } else { PathBuf::new() })); result } pub fn get(&self, name: impl ToString) -> Result<Value, Error> { let name = name.to_string(); if let Some(value) = self.symbols.get(&name) { Ok(value.clone()) } else { Ok(match name.as_str() { REPORT => Value::builtin(REPORT, |args, env| { check_args_len(env.get(REPORT)?, &args, 1)?; let val = args[0].eval(env)?; match val { Value::Nil | Value::Integer(0) => {} Value::Error(e) => println!("error: {}", e), other => println!(" => {:?}", other), } Ok(Value::Nil) }), PROMPT => Value::builtin(PROMPT, |args, env| { check_args_len(env.get(PROMPT)?, &args, 1)?; Ok(Value::String(format!("{}> ", args[0].eval(env)?))) }), INCOMPLETE_PROMPT => Value::builtin(INCOMPLETE_PROMPT, |args, env| { check_args_len(env.get(INCOMPLETE_PROMPT)?, &args, 1)?; Ok(Value::String(format!("{}> ", " ".repeat(format!("{}", args[0].eval(env)?).len())))) }), "absolute" => Value::builtin("absolute", |args, env| { check_args_len(env.get("absolute")?, &args, 1)?; match args[0].eval(env)? { Value::Path(path) => if let Ok(result) = dunce::canonicalize(path) { Ok(Value::Path(result)) } else { Err(Error::CustomError(String::from("could not canonicalize path"))) }, Value::Symbol(path) | Value::String(path) => if let Ok(result) = dunce::canonicalize(path) { Ok(Value::Path(result)) } else { Err(Error::CustomError(String::from("could not canonicalize path"))) }, _ => Err(Error::InvalidArguments(env.get("absolute")?, args.clone())) } }), "exists" => Value::builtin("exists", |args, env| { check_args_len(env.get("exists")?, &args, 1)?; match args[0].eval(env)? { Value::Path(path) => Ok(Value::Boolean(path.exists())), Value::String(path) | Value::Symbol(path) => Ok(Value::Boolean(PathBuf::from(path).exists())), _ => Err(Error::InvalidArguments(env.get("exists")?, args.clone())) } }), "cards" => CARDS.clone(), "chess" => CHESS.clone(), "rand" => { let mut random = BTreeMap::new(); random.insert("int".to_string(), Value::builtin("rand@int", |args, env| { check_args_len(Value::Symbol("rand@int".to_string()), &args, 2)?; if let (Value::Integer(l), Value::Integer(h)) = (args[0].eval(env)?, args[1].eval(env)?) { let mut rng = thread_rng(); let n = Uniform::new(l, h); Ok(Value::Integer(rng.sample(n))) } else { Err(Error::InvalidArguments(Value::Symbol("rand@int".to_string()), args.clone())) } })); random.insert("shuffle".to_string(), Value::builtin("rand@shuffle", |args, env| { check_args_len(Value::Symbol("rand@shuffle".to_string()), &args, 1)?; if let Value::List(mut list) = args[0].eval(env)? { let mut rng = thread_rng(); list.shuffle(&mut rng); Ok(Value::List(list)) } else { Err(Error::InvalidArguments(Value::Symbol("rand@shuffle".to_string()), args.clone())) } })); random.insert("choose".to_string(), Value::builtin("rand@choose", |args, env| { check_args_len(Value::Symbol("rand@choose".to_string()), &args, 1)?; if let Value::List(list) = args[0].eval(env)? { let mut rng = thread_rng(); let n = Uniform::new(0, list.len()); Ok(list[rng.sample(n)].clone()) } else { Err(Error::InvalidArguments(Value::Symbol("rand@choose".to_string()), args.clone())) } })); Value::Table(random) }, "file" => { let mut file = BTreeMap::new(); file.insert("read".to_string(), Value::builtin("file@read", |args, env| { check_args_len(Value::Symbol("file@read".to_string()), &args, 1)?; match args[0].eval(env)? { Value::Path(path) => { if let Ok(contents) = read_to_string(&env.get_cwd()?.join(&path)) { Ok(Value::String(contents)) } else { Err(Error::CustomError(format!("could not read file {:?}", path))) } }, Value::String(path) | Value::Symbol(path) => { if let Ok(contents) = read_to_string(&env.get_cwd()?.join(&path)) { Ok(Value::String(contents)) } else { Err(Error::CustomError(format!("could not read file {:?}", path))) } }, _ => Err(Error::InvalidArguments(Value::Symbol("file@read".to_string()), args.clone())) } })); file.insert("write".to_string(), Value::builtin("file@write", |args, env| { check_args_len(Value::Symbol("file@write".to_string()), &args, 2)?; if let Value::String(contents) = args[1].eval(env)? { match args[0].eval(env)? { Value::Path(path) => match write(&env.get_cwd()?.join(&path), contents) { Ok(_) => Ok(Value::Nil), _ => Err(Error::CustomError(format!("could not write to file {:?}", path))) }, Value::String(path) | Value::Symbol(path) => match write(&env.get_cwd()?.join(&path), contents) { Ok(_) => Ok(Value::Nil), _ => Err(Error::CustomError(format!("could not write to file {:?}", path))) }, _ => Err(Error::InvalidArguments(Value::Symbol("file@write".to_string()), args.clone())) } } else { Err(Error::InvalidArguments(Value::Symbol("file@write".to_string()), args.clone())) } })); file.insert("append".to_string(), Value::builtin("file@append", |args, env| { check_args_len(Value::Symbol("file@append".to_string()), &args, 2)?; let contents = match args[0].eval(env)? { Value::Path(path) => { if let Ok(contents) = read_to_string(&env.get_cwd()?.join(&path)) { contents } else { String::new() } }, Value::String(path) | Value::Symbol(path) => { if let Ok(contents) = read_to_string(&env.get_cwd()?.join(path)) { contents } else { String::new() } }, _ => return Err(Error::InvalidArguments(Value::Symbol("file@append".to_string()), args.clone())) }; if let Value::String(new_contents) = args[1].eval(env)? { match args[0].eval(env)? { Value::Path(path) => match write(&env.get_cwd()?.join(&path), contents.to_string() + &new_contents) { Ok(_) => Ok(Value::Nil), _ => Err(Error::CustomError(format!("could not write to file {:?}", path))) }, Value::String(path) | Value::Symbol(path) => match write(&env.get_cwd()?.join(&path), contents.to_string() + &new_contents) { Ok(_) => Ok(Value::Nil), _ => Err(Error::CustomError(format!("could not write to file {:?}", path))) }, _ => Err(Error::InvalidArguments(Value::Symbol("file@append".to_string()), args.clone())) } } else { Err(Error::InvalidArguments(Value::Symbol("file@append".to_string()), args.clone())) } })); Value::Table(file) } "is-err" => Value::builtin("is-err", |args, env| { check_args_len(env.get("is-err")?, &args, 1)?; Ok(Value::Boolean(match args[0].eval(env) { Ok(Value::Error(_)) | Err(_) => true, _ => false })) }), "is-syntax-err" => Value::builtin("is-syntax-err", |args, env| { check_args_len(env.get("is-syntax-err")?, &args, 1)?; Ok(Value::Boolean(match args[0].eval(env) { Ok(Value::Error(e)) => match *e { Error::SyntaxError(_) => true, _ => false, }, _ => false })) }), "widget" => { let mut widget = BTreeMap::new(); widget.insert(String::from("create"), Value::builtin("widget@create", |args, env| { check_args_len(Value::Symbol("widget@create".to_string()), &args, 4)?; // print(widget@create("♔", "testing", 7)) // print(widget@create("Chess", "testing!", 8)) // print(widget@add-vertical(widget@create("Chess", "testing!", 8), widget@create("♔", "hmm", 8))) let title = match args[0].eval(env)? { Value::String(x) => x, _ => return Err(Error::InvalidArguments(Value::Symbol("widget@create".to_string()), args.clone())) }; let text = match args[1].eval(env)? { Value::String(x) => x, _ => return Err(Error::InvalidArguments(Value::Symbol("widget@create".to_string()), args.clone())), }; let text_width = match args[2].eval(env)? { Value::Integer(x) if x > 4 => x as usize, _ => return Err(Error::InvalidArguments(Value::Symbol("widget@create".to_string()), args.clone())), } - 2; let widget_height = match args[3].eval(env)? { Value::Integer(x) if x >= 3 => x as usize, _ => return Err(Error::InvalidArguments(Value::Symbol("widget@create".to_string()), args.clone())), }; if text_width < title.len() { Err(Error::CustomError(String::from("width is less than title length"))) } else { let title_len = title.chars().collect::<Vec<char>>().len(); let mut left_border_half = "─".repeat(((text_width - title_len) as f64 / 2.0).round() as usize); let right_border_half = left_border_half.clone(); let left_len = left_border_half.chars().collect::<Vec<char>>().len(); if (left_len * 2 + title_len + 2) > text_width + 2 { left_border_half.pop(); } let mut result = format!("┌{left_side}{}{right_side}┐\n", title, left_side=left_border_half, right_side=right_border_half); let width = result.chars().collect::<Vec<char>>().len() - 1; let mut i = 0; for ch in text.chars() { if i == 0 { result.push(' '); i += 1; } if ch == '\n' { result += &" ".repeat(width-i); i = width; } else { result.push(ch); } if i >= width-1 { result += "\n"; i = 0; } else { i += 1; } } result += &" ".repeat(width-i); while result.lines().collect::<Vec<&str>>().len() < widget_height - 1 { result += &(String::from("\n") + &" ".repeat(width)); } result += &format!("\n└{left_side}{}{right_side}┘", "─".repeat(title_len), left_side=left_border_half, right_side=right_border_half); Ok(Value::String(result)) } })); widget.insert(String::from("add-horizontal"), Value::builtin("widget@add-horizontal", |args, env| { if args.is_empty() { Err(Error::TooFewArguments(Value::Symbol("widget@add-horizontal".to_string()), args.clone())) } else { let mut string_args = vec![]; let mut height = 0; for (i, arg) in args.iter().enumerate() { if let Value::String(s) = arg.eval(env)? { let lines = s.lines().map(ToString::to_string).collect::<Vec<String>>(); string_args.push(lines.clone()); height = string_args[0].len(); if height != lines.len() { return Err(Error::CustomError(format!("Heights of horizontally added widgets must be equal, 0={}, {}={}", height, i, lines.len()))) } } else { return Err(Error::InvalidArguments(Value::Symbol("widget@add-horizontal".to_string()), args.clone())); } } let mut result = String::new(); for line_n in 0..height { for arg in &string_args { result += &arg[line_n]; } result += "\n"; } Ok(Value::String(result)) } })); widget.insert(String::from("add-vertical"), Value::builtin("widget@add-vertical", |args, env| { if args.is_empty() { Err(Error::TooFewArguments(Value::Symbol("widget@add-vertical".to_string()), args.clone())) } else { let mut string_args = vec![]; for (i, arg) in args.iter().enumerate() { if let Value::String(s) = arg.eval(env)? { string_args.push(s.trim().to_string()); let width = string_args[0].lines().next().unwrap().chars().collect::<Vec<char>>().len(); let this_width = string_args[i].lines().next().unwrap().chars().collect::<Vec<char>>().len(); if width != this_width { return Err(Error::CustomError(format!("Widths of vertically added widgets must be equal, 0={}, {}={}", width, i, this_width))) } } else { return Err(Error::InvalidArguments(Value::Symbol("widget@add-vertical".to_string()), args.clone())); } } Ok(Value::String(string_args.join("\n"))) } })); Value::Table(widget) }, "fmt" => FMT.clone(), "math" => MATH.clone(), "sleep" => Value::builtin("sleep", |args, env| { check_args_len(env.get("sleep")?, &args, 1)?; match args[0].eval(env)? { Value::Float(n) => sleep(Duration::from_millis((n.abs() * 1000.0) as u64)), Value::Integer(n) => sleep(Duration::from_millis((n.abs() * 1000) as u64)), _ => return Err(Error::InvalidArguments(env.get("sleep")?, args.clone())) } Ok(Value::Nil) }), "to-path" => Value::builtin("to-path", |args, env| { check_args_len(env.get("to-path")?, &args, 1)?; match args[0].eval(env)? { Value::Path(x) => Ok(Value::Path(x)), Value::String(s) | Value::Symbol(s) => Ok(Value::Path(PathBuf::from(s))), _ => Err(Error::InvalidArguments(env.get("to-path")?, args.clone())) } }), "to-str" => Value::builtin("to-str", |args, env| { let mut result = String::new(); for (i, arg) in args.iter().enumerate() { result += &format!("{}", arg.eval(env)?); if i < args.len()-1 { result += " "; } } Ok(Value::String(result)) }), "to-float" => Value::builtin("to-float", |args, env| { check_args_len(env.get("to-float")?, &args, 1)?; match args[0].eval(env)? { Value::String(s) => match s.parse::<f64>() { Ok(n) => Ok(Value::Float(n)), Err(_) => Err(Error::CouldNotParseInteger(Value::String(s))), }, Value::Float(x) => Ok(Value::Float(x)), Value::Integer(x) => Ok(Value::Float(x as f64)), Value::Boolean(x) => Ok(Value::Float(if x { 1.0 } else { 0.0 })), _ => Err(Error::InvalidArguments(env.get("to-float")?, args.clone())) } }), "to-int" => Value::builtin("to-int", |args, env| { check_args_len(env.get("to-int")?, &args, 1)?; match args[0].eval(env)? { Value::String(s) => match s.parse::<i32>() { Ok(i) => Ok(Value::Integer(i)), Err(_) => Err(Error::CouldNotParseInteger(Value::String(s))), }, Value::Float(x) => Ok(Value::Integer(x as i32)), Value::Integer(x) => Ok(Value::Integer(x)), Value::Boolean(x) => Ok(Value::Integer(if x { 1 } else { 0 })), _ => Err(Error::InvalidArguments(env.get("to-int")?, args.clone())) } }), "input" => Value::builtin("input", |args, env| { let mut result = String::new(); for (i, arg) in args.iter().enumerate() { print!("{}", arg.eval(env)?); if i < args.len()-1 { print!(" "); } } let _ = stdout().flush(); if stdin().read_line(&mut result).is_err() { Err(Error::ReadInputError) } else { Ok(Value::String(result.trim_end_matches("\n").trim_end_matches("\r").to_string())) } }), "rev" => Value::builtin("rev", |args, env| { check_args_len(env.get("rev")?, &args, 1)?; match args[0].eval(env)? { Value::String(s) => Ok(Value::String(s.chars().rev().collect())), Value::List(l) => Ok(Value::List(l.into_iter().rev().collect())), _ => Err(Error::InvalidArguments(env.get("rev")?, args.clone())) } }), "split" => Value::builtin("split", |args, env| { check_args_len(env.get("split")?, &args, 2)?; if let Value::String(s) = args[0].eval(env)? { Ok(Value::List( s.split(&args[1].eval(env)?.to_string()) .map(|x| Value::String(x.to_string())) .collect() )) } else { Err(Error::InvalidArguments(env.get("join")?, args.clone())) } }), "sort" => Value::builtin("sort", |args, env| { check_args_len(env.get("sort")?, &args, 1)?; if let Value::List(list) = args[0].eval(env)? { let mut num_list = vec![]; for item in list { match item { Value::Integer(i) => num_list.push(i), _ => return Err(Error::InvalidArguments(env.get("sort")?, args.clone())) } } num_list.sort(); Ok(Value::List(num_list.iter().map(|x| Value::Integer(*x)).collect())) } else { Err(Error::InvalidArguments(env.get("sort")?, args.clone())) } }), "join" => Value::builtin("join", |args, env| { check_args_len(env.get("join")?, &args, 2)?; if let Value::List(list) = args[0].eval(env)? { Ok(Value::String( list .iter() .map(|x| x.to_string()) .collect::<Vec<String>>() .join(&args[1].eval(env)?.to_string()) )) } else { Err(Error::InvalidArguments(env.get("join")?, args.clone())) } }), "date" => { let now = Local::now().date(); let mut date = BTreeMap::new(); date.insert(String::from("day"), Value::Integer(now.day() as i32)); date.insert(String::from("weekday"), Value::Integer(now.weekday().num_days_from_sunday() as i32)); date.insert(String::from("month"), Value::Integer(now.month() as i32)); date.insert(String::from("year"), Value::Integer(now.year() as i32)); date.insert(String::from("str"), Value::String(now.format("%D").to_string())); Value::Table(date) } "time" => { let now = Local::now(); let mut time = BTreeMap::new(); time.insert(String::from("hour"), Value::Integer(now.hour() as i32)); time.insert(String::from("minute"), Value::Integer(now.minute() as i32)); time.insert(String::from("second"), Value::Integer(now.second() as i32)); time.insert(String::from("str"), Value::String(now.time().format("%-I:%M %p").to_string())); Value::Table(time) } "sh" => { let mut shell = BTreeMap::new(); if let Ok(path) = current_exe() { shell.insert(String::from("exe"), Value::Path(path.clone())); if let Some(parent) = path.parent() { shell.insert(String::from("dir"), Value::Path(PathBuf::from(parent))); } } shell.insert(String::from("version"), Value::List(VERSION.iter().map(|x| Value::Integer(*x as i32)).collect())); if let Ok(path) = self.get_home_dir() { shell.insert(String::from("prelude"), Value::Path(path.join(PRELUDE_FILENAME))); } Value::Table(shell) } "os" => { let os = os_info::get(); let mut os_table = BTreeMap::new(); os_table.insert(String::from("name"), Value::String(get_os_name(&os.os_type()))); os_table.insert(String::from("family"), Value::String(get_os_family(&os.os_type()))); os_table.insert(String::from("version"), Value::String(format!("{}", os.version()))); Value::Table(os_table) } "env" => Value::Table(self.get_symbols().clone()), HOME => Value::Path(self.get_home_dir()?), VIDEOS => Value::Path(self.get_vids_dir()?), DESKTOP => Value::Path(self.get_desk_dir()?), PICTURES => Value::Path(self.get_pics_dir()?), DOCUMENTS => Value::Path(self.get_docs_dir()?), DOWNLOADS => Value::Path(self.get_down_dir()?), "home" => Value::Macro(vec![], Box::new(Value::Define(CWD.to_string(), Box::new(self.get(HOME)?)))), "vids" => Value::Macro(vec![], Box::new(Value::Define(CWD.to_string(), Box::new(self.get(VIDEOS)?)))), "desk" => Value::Macro(vec![], Box::new(Value::Define(CWD.to_string(), Box::new(self.get(DESKTOP)?)))), "pics" => Value::Macro(vec![], Box::new(Value::Define(CWD.to_string(), Box::new(self.get(PICTURES)?)))), "docs" => Value::Macro(vec![], Box::new(Value::Define(CWD.to_string(), Box::new(self.get(DOCUMENTS)?)))), "down" => Value::Macro(vec![], Box::new(Value::Define(CWD.to_string(), Box::new(self.get(DOWNLOADS)?)))), "exit" | "quit" => Value::builtin("exit", |_, _| exit(0)), "unbind" => Value::builtin("unbind", |args, env| { check_args_len(env.get("unbind")?, &args, 1)?; match args[0].eval(env)? { Value::String(name) => { if env.is_defined(&name) { let result = env.get(&name)?; env.symbols.remove(&name); Ok(result) } else { Err(Error::SymbolNotDefined(name)) } } _ => Err(Error::InvalidArguments(env.get("unbind")?, args.clone())) } }), "print" => Value::builtin("print", |args, env| { let mut acc = Value::Nil; for (i, arg) in args.iter().enumerate() { acc = arg.eval(env)?; print!("{}", acc); if i < args.len()-1 { print!(" "); } else { println!(""); } } Ok(acc) }), "echo" => Value::builtin("print", |args, env| { for (i, arg) in args.iter().enumerate() { print!("{}", arg.eval(env)?); if i < args.len()-1 { print!(" "); } else { println!(""); } } Ok(Value::Nil) }), "pwd" | "cwd" => Value::builtin("pwd", |args, env| { check_args_len(env.get("pwd")?, &args, 0)?; println!("{}", env.get("CWD")?); Ok(Value::Nil) }), "cd-eval" => Value::builtin("cd-eval", |args, env| { if args.is_empty() { env.define(CWD, Value::Path(env.get_home_dir()?)); Ok(Value::Integer(0)) } else { check_args_len(env.get("cd-eval")?, &args, 1)?; let mut cwd = env.get_cwd()?; cwd.push(PathBuf::from(args[0].eval(env)?.to_string())); if cwd.exists() && cwd.is_dir() { env.define(CWD, Value::Path(match dunce::canonicalize(&cwd) { Ok(path) => path, Err(_) => cwd.clone() })); Ok(Value::Integer(0)) } else { Err(Error::CannotChangeDir(cwd)) } } }), "cd" => Value::builtin("cd", |args, env| { if args.is_empty() { env.define(CWD, Value::Path(env.get_home_dir()?)); Ok(Value::Integer(0)) } else { check_args_len(env.get("cd")?, &args, 1)?; let mut cwd = env.get_cwd()?; cwd.push(PathBuf::from(args[0].to_string())); if cwd.exists() && cwd.is_dir() { env.define(CWD, Value::Path(match dunce::canonicalize(&cwd) { Ok(path) => path, Err(_) => cwd.clone() })); Ok(Value::Integer(0)) } else { Err(Error::CannotChangeDir(cwd)) } } }), "clear" | "cls" => Value::builtin("cls", move |args, env| { check_args_len(env.get("cls")?, &args, 0)?; let family = get_os_family(&os_info::get().os_type()); if family == "linux" || family == "unix" { Value::Run(Box::new(Value::Path(PathBuf::from("clear"))), vec![]).eval(env) } else if family == "windows" { Value::Run(Box::new(Value::Path(PathBuf::from("cls"))), vec![]).eval(env) } else { println!("{}", "\n".repeat(255)); Ok(Value::Nil) } }), "keys" => Value::builtin("keys", |args, env| { check_args_len(env.get("keys")?, &args, 1)?; if let Value::Table(table) = args[0].eval(env)? { Ok(Value::List(table.keys().map(|x| Value::String(x.clone())).collect())) } else { Err(Error::InvalidArguments(env.get("keys")?, args.clone())) } }), "vals" => Value::builtin("vals", |args, env| { check_args_len(env.get("vals")?, &args, 1)?; if let Value::Table(table) = args[0].eval(env)? { Ok(Value::List(table.values().map(|x| x.clone()).collect())) } else { Err(Error::InvalidArguments(env.get("vals")?, args.clone())) } }), "insert" => Value::builtin("insert", |args, env| { check_args_len(env.get("insert")?, &args, 3)?; if let Value::Table(mut t) = args[0].eval(env)? { if let Value::String(key) = args[1].eval(env)? { t.insert(key, args[2].eval(env)?); Ok(Value::Table(t)) } else { Err(Error::InvalidArguments(env.get("insert")?, args.clone())) } } else { Err(Error::InvalidArguments(env.get("insert")?, args.clone())) } }), "remove" => Value::builtin("remove", |args, env| { check_args_len(env.get("remove")?, &args, 2)?; if let Value::Table(mut t) = args[0].eval(env)? { if let Value::String(key) = args[1].eval(env)? { t.remove(&key); Ok(Value::Table(t)) } else { Err(Error::InvalidArguments(env.get("remove")?, args.clone())) } } else { Err(Error::InvalidArguments(env.get("remove")?, args.clone())) } }), "len" => Value::builtin("len", |args, env| { check_args_len(env.get("len")?, &args, 1)?; match args[0].eval(env)? { Value::List(list) => Ok(Value::Integer(list.len() as i32)), Value::Table(t) => Ok(Value::Integer(t.len() as i32)), Value::String(s) => Ok(Value::Integer(s.chars().collect::<Vec<char>>().len() as i32)), Value::Path(path) => Ok(Value::Integer(path.components().collect::<Vec<Component>>().len() as i32)), _ => Err(Error::InvalidArguments(env.get("len")?, args.clone())) } }), "push" => Value::builtin("push", |args, env| { check_args_len(env.get("push")?, &args, 2)?; if let Value::List(mut list) = args[0].eval(env)? { for arg in &args[1..] { list.push(arg.eval(env)?); } Ok(Value::List(list)) } else { Err(Error::InvalidArguments(env.get("push")?, args.clone())) } }), "pop" => Value::builtin("pop", |args, env| { check_args_len(env.get("pop")?, &args, 1)?; match args[0].eval(env)? { Value::List(mut list) => { Ok(match list.pop() { Some(val) => val, None => Value::Nil }) } Value::String(mut s) => { Ok(if let Some(ch) = s.pop() { Value::String(ch.to_string()) } else { Value::Nil }) } Value::Path(path) => { Ok(Value::Path(if let Some(parent) = path.parent() { PathBuf::from(parent) } else { path })) } _ => Err(Error::InvalidArguments(env.get("pop")?, args.clone())) } }), "zip" => Value::builtin("zip", |args, env| { check_args_len(env.get("zip")?, &args, 2)?; match (args[0].eval(env)?, args[1].eval(env)?) { (Value::List(a), Value::List(b)) => Ok(Value::List(a.into_iter().zip(b.into_iter()).map(|(a, b)| Value::List(vec![a, b])).collect())), _ => Err(Error::InvalidArguments(env.get("zip")?, args.clone())) } }), "head" => Value::builtin("head", |args, env| { check_args_len(env.get("head")?, &args, 1)?; if let Value::List(list) = args[0].eval(env)? { if list.is_empty() { Err(Error::IndexNotFound(Value::List(list), Value::Integer(0))) } else { Ok(list[0].clone()) } } else { Err(Error::InvalidArguments(env.get("head")?, args.clone())) } }), "tail" => Value::builtin("tail", |args, env| { check_args_len(env.get("tail")?, &args, 1)?; if let Value::List(list) = args[0].eval(env)? { if list.is_empty() { Ok(Value::List(vec![])) } else { Ok(Value::List(list[1..].to_vec())) } } else { Err(Error::InvalidArguments(env.get("tail")?, args.clone())) } }), "map" => Value::builtin("map", |args, env| { check_args_len(env.get("map")?, &args, 2)?; let func = args[0].eval(env)?; if let Value::List(list) = args[1].eval(env)? { let mut result = vec![]; for item in list { result.push(Value::Apply(Box::new(func.clone()), vec![item]).eval(env)?) } Ok(Value::List(result)) } else { Err(Error::InvalidArguments(env.get("map")?, args.clone())) } }), "filter" => Value::builtin("filter", |args, env| { check_args_len(env.get("filter")?, &args, 2)?; let func = args[0].eval(env)?; if let Value::List(list) = args[1].eval(env)? { let mut result = vec![]; for item in list { let cond = Value::Apply(Box::new(func.clone()), vec![item.clone()]).eval(env)?; if let Value::Boolean(b) = cond { if b { result.push(item) } } else { return Err(Error::InvalidCondition(cond)) } } Ok(Value::List(result)) } else { Err(Error::InvalidArguments(env.get("map")?, args.clone())) } }), "reduce" => Value::builtin("reduce", |args, env| { check_args_len(env.get("reduce")?, &args, 3)?; let func = args[0].eval(env)?; let mut acc = args[1].eval(env)?; if let Value::List(list) = args[2].eval(env)? { for item in list { acc = Value::Apply(Box::new(func.clone()), vec![acc.clone(), item.clone()]).eval(env)?; } Ok(acc) } else { Err(Error::InvalidArguments(env.get("reduce")?, args.clone())) } }), "back" => Value::Macro(vec![], Box::new(Value::Apply(Box::new(Value::Symbol("cd".to_string())), vec![Value::String("..".to_string())]))), "add" => Value::Lambda(vec!["x".to_string(), "y".to_string()], Box::new(Value::Add(Box::new(Value::Symbol("x".to_string())), Box::new(Value::Symbol("y".to_string())))), Self::new()), "mul" => Value::Lambda(vec!["x".to_string(), "y".to_string()], Box::new(Value::Multiply(Box::new(Value::Symbol("x".to_string())), Box::new(Value::Symbol("y".to_string())))), Self::new()), "sub" => Value::Lambda(vec!["x".to_string(), "y".to_string()], Box::new(Value::Subtract(Box::new(Value::Symbol("x".to_string())), Box::new(Value::Symbol("y".to_string())))), Self::new()), "div" => Value::Lambda(vec!["x".to_string(), "y".to_string()], Box::new(Value::Divide(Box::new(Value::Symbol("x".to_string())), Box::new(Value::Symbol("y".to_string())))), Self::new()), "rem" => Value::Lambda(vec!["x".to_string(), "y".to_string()], Box::new(Value::Remainder(Box::new(Value::Symbol("x".to_string())), Box::new(Value::Symbol("y".to_string())))), Self::new()), "sum" => Value::Lambda(vec!["x".to_string()], Box::new(Value::Apply(Box::new(Value::Symbol("reduce".to_string())), vec![Value::Symbol("add".to_string()), Value::Integer(0), Value::Symbol("x".to_string())])), Self::new()), "prod" => Value::Lambda(vec!["x".to_string()], Box::new(Value::Apply(Box::new(Value::Symbol("reduce".to_string())), vec![Value::Symbol("mul".to_string()), Value::Integer(1), Value::Symbol("x".to_string())])), Self::new()), "inc" => Value::Lambda(vec!["x".to_string()], Box::new(Value::Add(Box::new(Value::Symbol("x".to_string())), Box::new(Value::Integer(1)))), Self::new()), "dec" => Value::Lambda(vec!["x".to_string()], Box::new(Value::Subtract(Box::new(Value::Symbol("x".to_string())), Box::new(Value::Integer(1)))), Self::new()), "double" => Value::Lambda(vec!["x".to_string()], Box::new(Value::Multiply(Box::new(Value::Symbol("x".to_string())), Box::new(Value::Integer(2)))), Self::new()), "triple" => Value::Lambda(vec!["x".to_string()], Box::new(Value::Multiply(Box::new(Value::Symbol("x".to_string())), Box::new(Value::Integer(3)))), Self::new()), "quadruple" => Value::Lambda(vec!["x".to_string()], Box::new(Value::Multiply(Box::new(Value::Symbol("x".to_string())), Box::new(Value::Integer(4)))), Self::new()), "quintuple" => Value::Lambda(vec!["x".to_string()], Box::new(Value::Multiply(Box::new(Value::Symbol("x".to_string())), Box::new(Value::Integer(5)))), Self::new()), x => { for t in TYPES { if x == get_os_name(t) { return Ok(Value::String(x.to_lowercase())) } else if x == get_os_family(t) { return Ok(Value::String(x.to_lowercase())) } } return Err(Error::SymbolNotDefined(name.clone())) } }) } } pub fn get_pics_dir(&self) -> Result<PathBuf, Error> { dirs::picture_dir().ok_or(Error::PicturesDirectoryNotFound) } pub fn get_vids_dir(&self) -> Result<PathBuf, Error> { dirs::video_dir().ok_or(Error::VideosDirectoryNotFound) } pub fn get_down_dir(&self) -> Result<PathBuf, Error> { dirs::download_dir().ok_or(Error::DownloadsDirectoryNotFound) } pub fn get_desk_dir(&self) -> Result<PathBuf, Error> { dirs::desktop_dir().ok_or(Error::DesktopDirectoryNotFound) } pub fn get_docs_dir(&self) -> Result<PathBuf, Error> { dirs::document_dir().ok_or(Error::DocumentsDirectoryNotFound) } pub fn get_home_dir(&self) -> Result<PathBuf, Error> { dirs::home_dir().ok_or(Error::HomeDirectoryNotFound) } pub fn get_cwd(&self) -> Result<PathBuf, Error> { if let Ok(Value::Path(result)) = self.get(CWD) { Ok(result) } else { Ok(PathBuf::from(self.get_home_dir()?)) } } pub(crate) fn get_symbols(&self) -> &BTreeMap<String, Value> { &self.symbols } pub fn is_defined(&self, name: &String) -> bool { self.symbols.contains_key(name) } pub fn define(&mut self, name: impl ToString, value: Value) { self.symbols.insert(name.to_string(), value); } pub fn combine(&self, other: &Self) -> Self { let mut result = self.clone(); result.symbols.extend(other.symbols.clone()); result } }
// 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_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()?, ); } "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()?, ); } "ResourceType" => { builder = builder.set_resource_type( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::ResourceType::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", )) } } } 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_exceptionjson_err( input: &[u8], mut builder: crate::error::internal_server_exception::Builder, ) -> Result<crate::error::internal_server_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_resource_not_found_exceptionjson_err( input: &[u8], mut builder: crate::error::resource_not_found_exception::Builder, ) -> Result<crate::error::resource_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()?, ); } "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()?, ); } "ResourceType" => { builder = builder.set_resource_type( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::ResourceType::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", )) } } } 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_throttling_exceptionjson_err( input: &[u8], mut builder: crate::error::throttling_exception::Builder, ) -> Result<crate::error::throttling_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_validation_exceptionjson_err( input: &[u8], mut builder: crate::error::validation_exception::Builder, ) -> Result<crate::error::validation_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_access_denied_exceptionjson_err( input: &[u8], mut builder: crate::error::access_denied_exception::Builder, ) -> Result<crate::error::access_denied_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_service_limit_exceeded_exceptionjson_err( input: &[u8], mut builder: crate::error::service_limit_exceeded_exception::Builder, ) -> Result<crate::error::service_limit_exceeded_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() { "LimitName" => { builder = builder.set_limit_name( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::LimitName::from(u.as_ref())) }) .transpose()?, ); } "LimitValue" => { builder = builder.set_limit_value( smithy_json::deserialize::token::expect_number_or_null(tokens.next())? .map(|v| v.to_f64()), ); } "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_data_set( input: &[u8], mut builder: crate::output::create_data_set_output::Builder, ) -> Result<crate::output::create_data_set_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() { "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()?, ); } "AssetType" => { builder = builder.set_asset_type( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::AssetType::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::DateTime, )?, ); } "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()?, ); } "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()?, ); } "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()?, ); } "Origin" => { builder = builder.set_origin( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::Origin::from(u.as_ref())) }) .transpose()?, ); } "OriginDetails" => { builder = builder.set_origin_details( crate::json_deser::deser_structure_origin_details(tokens)?, ); } "SourceId" => { builder = builder.set_source_id( 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)?); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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() { "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::DateTime, )?, ); } "Details" => { builder = builder.set_details( crate::json_deser::deser_structure_response_details(tokens)?, ); } "Errors" => { builder = builder .set_errors(crate::json_deser::deser_list_list_of_job_error(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()?, ); } "State" => { builder = builder.set_state( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::State::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()?, ); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_revision( input: &[u8], mut builder: crate::output::create_revision_output::Builder, ) -> Result<crate::output::create_revision_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() { "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()?, ); } "Comment" => { builder = builder.set_comment( 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::DateTime, )?, ); } "DataSetId" => { builder = builder.set_data_set_id( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "Finalized" => { builder = builder.set_finalized( smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?, ); } "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()?, ); } "SourceId" => { builder = builder.set_source_id( 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)?); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_asset( input: &[u8], mut builder: crate::output::get_asset_output::Builder, ) -> Result<crate::output::get_asset_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() { "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()?, ); } "AssetDetails" => { builder = builder.set_asset_details( crate::json_deser::deser_structure_asset_details(tokens)?, ); } "AssetType" => { builder = builder.set_asset_type( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::AssetType::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::DateTime, )?, ); } "DataSetId" => { builder = builder.set_data_set_id( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "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()?, ); } "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()?, ); } "RevisionId" => { builder = builder.set_revision_id( 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_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_data_set( input: &[u8], mut builder: crate::output::get_data_set_output::Builder, ) -> Result<crate::output::get_data_set_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() { "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()?, ); } "AssetType" => { builder = builder.set_asset_type( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::AssetType::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::DateTime, )?, ); } "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()?, ); } "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()?, ); } "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()?, ); } "Origin" => { builder = builder.set_origin( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::Origin::from(u.as_ref())) }) .transpose()?, ); } "OriginDetails" => { builder = builder.set_origin_details( crate::json_deser::deser_structure_origin_details(tokens)?, ); } "SourceId" => { builder = builder.set_source_id( 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)?); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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() { "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::DateTime, )?, ); } "Details" => { builder = builder.set_details( crate::json_deser::deser_structure_response_details(tokens)?, ); } "Errors" => { builder = builder .set_errors(crate::json_deser::deser_list_list_of_job_error(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()?, ); } "State" => { builder = builder.set_state( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::State::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()?, ); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_revision( input: &[u8], mut builder: crate::output::get_revision_output::Builder, ) -> Result<crate::output::get_revision_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() { "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()?, ); } "Comment" => { builder = builder.set_comment( 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::DateTime, )?, ); } "DataSetId" => { builder = builder.set_data_set_id( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "Finalized" => { builder = builder.set_finalized( smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?, ); } "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()?, ); } "SourceId" => { builder = builder.set_source_id( 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)?); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_data_set_revisions( input: &[u8], mut builder: crate::output::list_data_set_revisions_output::Builder, ) -> Result<crate::output::list_data_set_revisions_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()?, ); } "Revisions" => { builder = builder.set_revisions( crate::json_deser::deser_list_list_of_revision_entry(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_data_sets( input: &[u8], mut builder: crate::output::list_data_sets_output::Builder, ) -> Result<crate::output::list_data_sets_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() { "DataSets" => { builder = builder.set_data_sets( crate::json_deser::deser_list_list_of_data_set_entry(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_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_entry(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_revision_assets( input: &[u8], mut builder: crate::output::list_revision_assets_output::Builder, ) -> Result<crate::output::list_revision_assets_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() { "Assets" => { builder = builder .set_assets(crate::json_deser::deser_list_list_of_asset_entry(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_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_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", )) } } } 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_asset( input: &[u8], mut builder: crate::output::update_asset_output::Builder, ) -> Result<crate::output::update_asset_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() { "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()?, ); } "AssetDetails" => { builder = builder.set_asset_details( crate::json_deser::deser_structure_asset_details(tokens)?, ); } "AssetType" => { builder = builder.set_asset_type( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::AssetType::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::DateTime, )?, ); } "DataSetId" => { builder = builder.set_data_set_id( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "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()?, ); } "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()?, ); } "RevisionId" => { builder = builder.set_revision_id( 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_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_data_set( input: &[u8], mut builder: crate::output::update_data_set_output::Builder, ) -> Result<crate::output::update_data_set_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() { "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()?, ); } "AssetType" => { builder = builder.set_asset_type( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::AssetType::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::DateTime, )?, ); } "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()?, ); } "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()?, ); } "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()?, ); } "Origin" => { builder = builder.set_origin( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| { s.to_unescaped() .map(|u| crate::model::Origin::from(u.as_ref())) }) .transpose()?, ); } "OriginDetails" => { builder = builder.set_origin_details( crate::json_deser::deser_structure_origin_details(tokens)?, ); } "SourceId" => { builder = builder.set_source_id( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_revision( input: &[u8], mut builder: crate::output::update_revision_output::Builder, ) -> Result<crate::output::update_revision_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() { "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()?, ); } "Comment" => { builder = builder.set_comment( 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::DateTime, )?, ); } "DataSetId" => { builder = builder.set_data_set_id( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "Finalized" => { builder = builder.set_finalized( smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?, ); } "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()?, ); } "SourceId" => { builder = builder.set_source_id( smithy_json::deserialize::token::expect_string_or_null(tokens.next())? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_origin_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::OriginDetails>, 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::OriginDetails::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() { "ProductId" => { builder = builder.set_product_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", )), } } #[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_response_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ResponseDetails>, 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::ResponseDetails::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() { "ExportAssetToSignedUrl" => { builder = builder.set_export_asset_to_signed_url( crate::json_deser::deser_structure_export_asset_to_signed_url_response_details(tokens)? ); } "ExportAssetsToS3" => { builder = builder.set_export_assets_to_s3( crate::json_deser::deser_structure_export_assets_to_s3_response_details(tokens)? ); } "ExportRevisionsToS3" => { builder = builder.set_export_revisions_to_s3( crate::json_deser::deser_structure_export_revisions_to_s3_response_details(tokens)? ); } "ImportAssetFromSignedUrl" => { builder = builder.set_import_asset_from_signed_url( crate::json_deser::deser_structure_import_asset_from_signed_url_response_details(tokens)? ); } "ImportAssetsFromS3" => { builder = builder.set_import_assets_from_s3( crate::json_deser::deser_structure_import_assets_from_s3_response_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", )), } } #[allow(clippy::type_complexity, non_snake_case)] pub fn deser_list_list_of_job_error<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::JobError>>, 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_error(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_asset_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AssetDetails>, 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::AssetDetails::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() { "S3SnapshotAsset" => { builder = builder.set_s3_snapshot_asset( crate::json_deser::deser_structure_s3_snapshot_asset(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_revision_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::RevisionEntry>>, 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_revision_entry(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_data_set_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::DataSetEntry>>, 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_data_set_entry(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_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::JobEntry>>, 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_entry(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_asset_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::AssetEntry>>, 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_asset_entry(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_export_asset_to_signed_url_response_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<crate::model::ExportAssetToSignedUrlResponseDetails>, 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::ExportAssetToSignedUrlResponseDetails::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() { "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()?, ); } "DataSetId" => { builder = builder.set_data_set_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "RevisionId" => { builder = builder.set_revision_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "SignedUrl" => { builder = builder.set_signed_url( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "SignedUrlExpiresAt" => { builder = builder.set_signed_url_expires_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_export_assets_to_s3_response_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ExportAssetsToS3ResponseDetails>, 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::ExportAssetsToS3ResponseDetails::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() { "AssetDestinations" => { builder = builder.set_asset_destinations( crate::json_deser::deser_list_list_of_asset_destination_entry( tokens, )?, ); } "DataSetId" => { builder = builder.set_data_set_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "Encryption" => { builder = builder.set_encryption( crate::json_deser::deser_structure_export_server_side_encryption(tokens)? ); } "RevisionId" => { builder = builder.set_revision_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_export_revisions_to_s3_response_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ExportRevisionsToS3ResponseDetails>, 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::ExportRevisionsToS3ResponseDetails::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() { "DataSetId" => { builder = builder.set_data_set_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "Encryption" => { builder = builder.set_encryption( crate::json_deser::deser_structure_export_server_side_encryption(tokens)? ); } "RevisionDestinations" => { builder = builder.set_revision_destinations( crate::json_deser::deser_list_list_of_revision_destination_entry(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_import_asset_from_signed_url_response_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<crate::model::ImportAssetFromSignedUrlResponseDetails>, 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::ImportAssetFromSignedUrlResponseDetails::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() { "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()?, ); } "DataSetId" => { builder = builder.set_data_set_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "Md5Hash" => { builder = builder.set_md5_hash( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "RevisionId" => { builder = builder.set_revision_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "SignedUrl" => { builder = builder.set_signed_url( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "SignedUrlExpiresAt" => { builder = builder.set_signed_url_expires_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_import_assets_from_s3_response_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ImportAssetsFromS3ResponseDetails>, 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::ImportAssetsFromS3ResponseDetails::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() { "AssetSources" => { builder = builder.set_asset_sources( crate::json_deser::deser_list_list_of_asset_source_entry( tokens, )?, ); } "DataSetId" => { builder = builder.set_data_set_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "RevisionId" => { builder = builder.set_revision_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_job_error<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::JobError>, 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::JobError::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() { "Code" => { builder = builder.set_code( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Code::from(u.as_ref())) }) .transpose()?, ); } "Details" => { builder = builder.set_details( crate::json_deser::deser_structure_details(tokens)?, ); } "LimitName" => { builder = builder.set_limit_name( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::JobErrorLimitName::from(u.as_ref()) }) }) .transpose()?, ); } "LimitValue" => { builder = builder.set_limit_value( smithy_json::deserialize::token::expect_number_or_null( tokens.next(), )? .map(|v| v.to_f64()), ); } "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()?, ); } "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()?, ); } "ResourceType" => { builder = builder.set_resource_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::JobErrorResourceTypes::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_snapshot_asset<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::S3SnapshotAsset>, 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::S3SnapshotAsset::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() { "Size" => { builder = builder.set_size( 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_revision_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::RevisionEntry>, 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::RevisionEntry::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()?, ); } "Comment" => { builder = builder.set_comment( 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::DateTime, )?, ); } "DataSetId" => { builder = builder.set_data_set_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "Finalized" => { builder = builder.set_finalized( smithy_json::deserialize::token::expect_bool_or_null( tokens.next(), )?, ); } "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()?, ); } "SourceId" => { builder = builder.set_source_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_data_set_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::DataSetEntry>, 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::DataSetEntry::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()?, ); } "AssetType" => { builder = builder.set_asset_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::AssetType::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::DateTime, )?, ); } "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()?, ); } "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()?, ); } "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()?, ); } "Origin" => { builder = builder.set_origin( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::Origin::from(u.as_ref())) }) .transpose()?, ); } "OriginDetails" => { builder = builder.set_origin_details( crate::json_deser::deser_structure_origin_details(tokens)?, ); } "SourceId" => { builder = builder.set_source_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::JobEntry>, 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::JobEntry::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::DateTime, )?, ); } "Details" => { builder = builder.set_details( crate::json_deser::deser_structure_response_details(tokens)?, ); } "Errors" => { builder = builder.set_errors( crate::json_deser::deser_list_list_of_job_error(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()?, ); } "State" => { builder = builder.set_state( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::State::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()?, ); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_asset_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AssetEntry>, 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::AssetEntry::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()?, ); } "AssetDetails" => { builder = builder.set_asset_details( crate::json_deser::deser_structure_asset_details(tokens)?, ); } "AssetType" => { builder = builder.set_asset_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped() .map(|u| crate::model::AssetType::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::DateTime, )?, ); } "DataSetId" => { builder = builder.set_data_set_id( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "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()?, ); } "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()?, ); } "RevisionId" => { builder = builder.set_revision_id( 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_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "UpdatedAt" => { builder = builder.set_updated_at( smithy_json::deserialize::token::expect_timestamp_or_null( tokens.next(), smithy_types::instant::Format::DateTime, )?, ); } _ => 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_asset_destination_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::vec::Vec<crate::model::AssetDestinationEntry>>, 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_asset_destination_entry(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_export_server_side_encryption<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::ExportServerSideEncryption>, 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::ExportServerSideEncryption::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() { "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()?, ); } "Type" => { builder = builder.set_type( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| { s.to_unescaped().map(|u| { crate::model::ServerSideEncryptionTypes::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_revision_destination_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<std::vec::Vec<crate::model::RevisionDestinationEntry>>, 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_revision_destination_entry(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_asset_source_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<std::vec::Vec<crate::model::AssetSourceEntry>>, 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_asset_source_entry(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_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::Details>, 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::Details::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() { "ImportAssetFromSignedUrlJobErrorDetails" => { builder = builder.set_import_asset_from_signed_url_job_error_details( crate::json_deser::deser_structure_import_asset_from_signed_url_job_error_details(tokens)? ); } "ImportAssetsFromS3JobErrorDetails" => { builder = builder.set_import_assets_from_s3_job_error_details( crate::json_deser::deser_list_list_of_asset_source_entry( 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_asset_destination_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AssetDestinationEntry>, 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::AssetDestinationEntry::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() { "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()?, ); } "Bucket" => { builder = builder.set_bucket( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "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()?, ); } _ => 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_revision_destination_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::RevisionDestinationEntry>, 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::RevisionDestinationEntry::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() { "Bucket" => { builder = builder.set_bucket( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "KeyPattern" => { builder = builder.set_key_pattern( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "RevisionId" => { builder = builder.set_revision_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_asset_source_entry<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result<Option<crate::model::AssetSourceEntry>, 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::AssetSourceEntry::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() { "Bucket" => { builder = builder.set_bucket( smithy_json::deserialize::token::expect_string_or_null( tokens.next(), )? .map(|s| s.to_unescaped().map(|u| u.into_owned())) .transpose()?, ); } "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()?, ); } _ => 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_import_asset_from_signed_url_job_error_details<'a, I>( tokens: &mut std::iter::Peekable<I>, ) -> Result< Option<crate::model::ImportAssetFromSignedUrlJobErrorDetails>, 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::ImportAssetFromSignedUrlJobErrorDetails::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() { "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()?, ); } _ => 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", )), } }
use std::{ fs, fmt }; use crate::route::Route; use dhttp::{ Version, Method, header::{Header, Headers} }; #[derive(Debug, Clone)] pub struct Request<R> { pub method: Method, pub headers: Vec<Header>, pub route: Route, pub http_version: Version, pub body: R, } pub struct RequestBody {} impl<R: Into<RequestBody> + Default> Default for Request<R> { fn default() -> Self { Self { body: R::default(), ..Default::default() } } } impl<R: Into<RequestBody> + Default> Request<R> { pub fn new() -> Self { Self::default() } } impl<R: Into<RequestBody> + Default> From<String> for Request<R> { fn from(req: String) -> Self { match req.lines().next() { Some(req_line) => { match req_line.split(" ").next() { Some("GET") => Self::default(), Some("POST") => Self::default(), _ => Self::default() } }, None => Self::default(), } } } impl fmt::Display for Request<&str> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.http_version.into())?; f.write_str(self.method.clone().into())?; f.write_str(self.body)?; Ok(()) } } pub trait Body { }
use std::collections::BTreeSet; use std::fmt; use pancurses::chtype; pub const X: usize = 63; pub const Y: usize = 31; pub use self::Static::*; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Static { Wall, Gate, Goal { health: usize, max_health: usize }, Turret { info: TurretInfo }, Obstacle { health: usize, max_health: usize }, } #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct TurretInfo { pub form: (), pub cooldown: usize, pub max_cooldown: usize, pub range: usize, pub health: usize, pub max_health: usize, pub arrow_speed: usize, pub damage_factor: usize, } pub use self::Mobile::*; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Mobile { Player, Fiend { info: FiendInfo }, Arrow { info: ArrowInfo }, } impl Mobile { pub fn is_player(&self) -> bool { match *self { Player => true, _ => false, } } } #[derive(Clone, Copy, PartialEq, Eq)] pub struct PlayerInfo { pub location: (usize, usize), pub health: usize, pub max_health: usize, pub damage_factor: usize, pub heal_factor: usize, pub armour_factor: usize, } #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] pub struct FiendName { pub prefix: &'static str, pub name: &'static str, pub suffix: Option<&'static str>, } impl fmt::Display for FiendName { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}{}{}", self.prefix, self.name, self.suffix.unwrap_or("")) } } #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct FiendInfo { pub ch: chtype, pub name: FiendName, pub form: (), pub health: usize, pub max_health: usize, pub damage_factor: usize, pub armour_factor: usize, pub player_target_distance: usize, pub goal_target_distance: usize, pub turret_target_distance: usize, pub obstacle_target_distance: usize, pub value: usize, } #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct ArrowInfo { // Vector (absolute) pub dx: usize, pub dy: usize, pub dir: (bool, bool), // Vector direction pub incx: i8, // [-1,1] pub incy: i8, // [-1,1] // Movement speed pub speed: usize, // Bresenham pub err: i32, pub err_inc: i32, pub err_dec: i32, pub corrx: i8, // [-1,1] pub corry: i8, // [-1,1] // Fiend damage pub damage_factor: usize, } #[derive(PartialEq, Eq, Clone, Copy)] pub enum Menu { Root, Build, Move(usize), Place(Static, (usize, usize)), } // pub enum RootItem { // Build, // Move, // Upgrade, // Continue // } // // pub enum BuildItem { // Turret, // Obstacle // } // pub struct WorldData { pub statics: [[Option<Static>; X]; Y], pub mobiles: [[Option<Mobile>; X]; Y], pub player_info: PlayerInfo, pub goal_location: (usize, usize), pub fiends: BTreeSet<(usize, usize)>, pub turrets: BTreeSet<(usize, usize)>, pub arrows: BTreeSet<(usize, usize)>, pub obstacles: BTreeSet<(usize, usize)>, pub gates: BTreeSet<(usize, usize)>, pub log: [String; 5], pub cash: usize, pub wave: usize, } impl WorldData { pub fn log_msg(&mut self, msg: String) { let len = self.log.len(); for i in 1..len { self.log[len - i] = self.log[len - i - 1].clone(); } self.log[0] = msg; } } pub use self::GameState::*; #[derive(PartialEq, Eq)] pub enum GameState { Startup, Construct { menu: Menu, menu_index: usize }, Fight { to_spawn: Vec<FiendInfo> }, GameOver { msg: String }, End, }
#![deny(clippy::all)] // #![deny(missing_docs)] #![deny(unsafe_code)] #![recursion_limit = "512"] pub mod core; #[cfg(not(target_arch = "wasm32"))] extern { #[allow(dead_code)] #[doc(hidden)] fn tree_sitter_wast() -> tree_sitter_sys::Language; #[allow(dead_code)] #[doc(hidden)] fn tree_sitter_wat() -> tree_sitter_sys::Language; #[allow(dead_code)] #[doc(hidden)] fn tree_sitter_wit() -> tree_sitter_sys::Language; #[allow(dead_code)] #[doc(hidden)] fn tree_sitter_witx() -> tree_sitter_sys::Language; }
use tracing::debug; fn insert_byte(map: &mut std::collections::HashMap<u8, usize>, b: &u8) { match map.get_mut(b) { None => { map.insert(*b, 1); } Some(count) => { *count += 1; } } } fn remove_byte(map: &mut std::collections::HashMap<u8, usize>, b: &u8) { match map.get_mut(b) { None => unreachable!(), Some(count) => { if *count == 1 { map.remove(b); } else { *count -= 1; } } } } #[derive(Debug)] #[allow(dead_code)] struct FirstMarker { characters: String, position: usize, } fn start_of_packet_marker(input: &str) -> FirstMarker { start_marker(input, 4) } fn start_of_message_marker(input: &str) -> FirstMarker { start_marker(input, 14) } fn start_marker(input: &str, distinct_count: usize) -> FirstMarker { let input_bytes = input.as_bytes(); let mut last_four_map = { let mut map = std::collections::HashMap::new(); for b in &input_bytes[..distinct_count] { insert_byte(&mut map, b); } map }; let mut last_four_stack: std::collections::VecDeque<_> = input_bytes[..distinct_count].to_vec().into(); let mut position = distinct_count; for b in &input_bytes[distinct_count..] { debug!("last_four_map: {last_four_map:?}"); if last_four_map.len() == distinct_count { return FirstMarker { characters: String::from_utf8(last_four_stack.into()).unwrap(), position, }; } remove_byte(&mut last_four_map, &last_four_stack.pop_front().unwrap()); insert_byte(&mut last_four_map, b); last_four_stack.push_back(*b); position += 1; } unreachable!(); } pub fn part1(input: &str) { tracing::info!("Part 1 Answer: {:?}", start_of_packet_marker(input)); } pub fn part2(input: &str) { tracing::info!("Part 2 Answer: {:?}", start_of_message_marker(input)); } #[cfg(test)] mod tests { use {super::*, test_case::test_case, tracing_test::traced_test}; #[test_case("bvwbjplbgvbhsrlpgdmjqwftvncz", 5)] #[test_case("nppdvjthqldpwncqszvftbrmjlhg", 6)] #[test_case("nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg", 10)] #[test_case("zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw", 11)] #[traced_test] fn first_packet_marker_location(input: &str, expected_position: usize) { assert_eq!(start_of_packet_marker(input).position, expected_position); } #[test_case("mjqjpqmgbljsphdztnvjfqwrcgsmlb", 19)] #[test_case("bvwbjplbgvbhsrlpgdmjqwftvncz", 23)] #[test_case("nppdvjthqldpwncqszvftbrmjlhg", 23)] #[test_case("nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg", 29)] #[test_case("zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw", 26)] #[traced_test] fn first_message_marker_location(input: &str, expected_position: usize) { assert_eq!(start_of_message_marker(input).position, expected_position); } }
use super::{ int::{PyInt, PyIntRef}, iter::IterStatus::{self, Exhausted}, PositionIterInternal, PyBytesRef, PyDict, PyTupleRef, PyType, PyTypeRef, }; use crate::{ anystr::{self, adjust_indices, AnyStr, AnyStrContainer, AnyStrWrapper}, atomic_func, class::PyClassImpl, common::str::{BorrowedStr, PyStrKind, PyStrKindData}, convert::{IntoPyException, ToPyException, ToPyObject, ToPyResult}, format::{format, format_map}, function::{ArgIterable, ArgSize, FuncArgs, OptionalArg, OptionalOption, PyComparisonValue}, intern::PyInterned, object::{Traverse, TraverseFn}, protocol::{PyIterReturn, PyMappingMethods, PyNumberMethods, PySequenceMethods}, sequence::SequenceExt, sliceable::{SequenceIndex, SliceableSequenceOp}, types::{ AsMapping, AsNumber, AsSequence, Comparable, Constructor, Hashable, IterNext, Iterable, PyComparisonOp, Representable, SelfIter, Unconstructible, }, AsObject, Context, Py, PyExact, PyObject, PyObjectRef, PyPayload, PyRef, PyRefExact, PyResult, TryFromBorrowedObject, VirtualMachine, }; use ascii::{AsciiStr, AsciiString}; use bstr::ByteSlice; use itertools::Itertools; use num_traits::ToPrimitive; use once_cell::sync::Lazy; use rustpython_common::{ ascii, atomic::{self, PyAtomic, Radium}, hash, lock::PyMutex, }; use rustpython_format::{FormatSpec, FormatString, FromTemplate}; use std::{char, fmt, ops::Range, string::ToString}; use unic_ucd_bidi::BidiClass; use unic_ucd_category::GeneralCategory; use unic_ucd_ident::{is_xid_continue, is_xid_start}; use unicode_casing::CharExt; impl<'a> TryFromBorrowedObject<'a> for String { fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> { obj.try_value_with(|pystr: &PyStr| Ok(pystr.as_str().to_owned()), vm) } } impl<'a> TryFromBorrowedObject<'a> for &'a str { fn try_from_borrowed_object(vm: &VirtualMachine, obj: &'a PyObject) -> PyResult<Self> { let pystr: &Py<PyStr> = TryFromBorrowedObject::try_from_borrowed_object(vm, obj)?; Ok(pystr.as_str()) } } #[pyclass(module = false, name = "str")] pub struct PyStr { bytes: Box<[u8]>, kind: PyStrKindData, hash: PyAtomic<hash::PyHash>, } impl fmt::Debug for PyStr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("PyStr") .field("value", &self.as_str()) .field("kind", &self.kind) .field("hash", &self.hash) .finish() } } impl AsRef<str> for PyStr { fn as_ref(&self) -> &str { self.as_str() } } impl AsRef<str> for Py<PyStr> { fn as_ref(&self) -> &str { self.as_str() } } impl AsRef<str> for PyStrRef { fn as_ref(&self) -> &str { self.as_str() } } impl<'a> From<&'a AsciiStr> for PyStr { fn from(s: &'a AsciiStr) -> Self { s.to_owned().into() } } impl From<AsciiString> for PyStr { fn from(s: AsciiString) -> Self { unsafe { Self::new_ascii_unchecked(s.into()) } } } impl<'a> From<&'a str> for PyStr { fn from(s: &'a str) -> Self { s.to_owned().into() } } impl From<String> for PyStr { fn from(s: String) -> Self { s.into_boxed_str().into() } } impl<'a> From<std::borrow::Cow<'a, str>> for PyStr { fn from(s: std::borrow::Cow<'a, str>) -> Self { s.into_owned().into() } } impl From<Box<str>> for PyStr { #[inline] fn from(value: Box<str>) -> Self { // doing the check is ~10x faster for ascii, and is actually only 2% slower worst case for // non-ascii; see https://github.com/RustPython/RustPython/pull/2586#issuecomment-844611532 let is_ascii = value.is_ascii(); let bytes = value.into_boxed_bytes(); let kind = if is_ascii { PyStrKind::Ascii } else { PyStrKind::Utf8 } .new_data(); Self { bytes, kind, hash: Radium::new(hash::SENTINEL), } } } pub type PyStrRef = PyRef<PyStr>; impl fmt::Display for PyStr { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(self.as_str(), f) } } pub trait AsPyStr<'a> where Self: 'a, { #[allow(clippy::wrong_self_convention)] // to implement on refs fn as_pystr(self, ctx: &Context) -> &'a Py<PyStr>; } impl<'a> AsPyStr<'a> for &'a Py<PyStr> { #[inline] fn as_pystr(self, _ctx: &Context) -> &'a Py<PyStr> { self } } impl<'a> AsPyStr<'a> for &'a PyStrRef { #[inline] fn as_pystr(self, _ctx: &Context) -> &'a Py<PyStr> { self } } impl AsPyStr<'static> for &'static str { #[inline] fn as_pystr(self, ctx: &Context) -> &'static Py<PyStr> { ctx.intern_str(self) } } impl<'a> AsPyStr<'a> for &'a PyStrInterned { #[inline] fn as_pystr(self, _ctx: &Context) -> &'a Py<PyStr> { self } } #[pyclass(module = false, name = "str_iterator", traverse = "manual")] #[derive(Debug)] pub struct PyStrIterator { internal: PyMutex<(PositionIterInternal<PyStrRef>, usize)>, } unsafe impl Traverse for PyStrIterator { fn traverse(&self, tracer: &mut TraverseFn) { // No need to worry about deadlock, for inner is a PyStr and can't make ref cycle self.internal.lock().0.traverse(tracer); } } impl PyPayload for PyStrIterator { fn class(ctx: &Context) -> &'static Py<PyType> { ctx.types.str_iterator_type } } #[pyclass(with(Constructor, IterNext, Iterable))] impl PyStrIterator { #[pymethod(magic)] fn length_hint(&self) -> usize { self.internal.lock().0.length_hint(|obj| obj.char_len()) } #[pymethod(magic)] fn setstate(&self, state: PyObjectRef, vm: &VirtualMachine) -> PyResult<()> { let mut internal = self.internal.lock(); internal.1 = usize::MAX; internal .0 .set_state(state, |obj, pos| pos.min(obj.char_len()), vm) } #[pymethod(magic)] fn reduce(&self, vm: &VirtualMachine) -> PyTupleRef { self.internal .lock() .0 .builtins_iter_reduce(|x| x.clone().into(), vm) } } impl Unconstructible for PyStrIterator {} impl SelfIter for PyStrIterator {} impl IterNext for PyStrIterator { fn next(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<PyIterReturn> { let mut internal = zelf.internal.lock(); if let IterStatus::Active(s) = &internal.0.status { let value = s.as_str(); if internal.1 == usize::MAX { if let Some((offset, ch)) = value.char_indices().nth(internal.0.position) { internal.0.position += 1; internal.1 = offset + ch.len_utf8(); return Ok(PyIterReturn::Return(ch.to_pyobject(vm))); } } else if let Some(value) = value.get(internal.1..) { if let Some(ch) = value.chars().next() { internal.0.position += 1; internal.1 += ch.len_utf8(); return Ok(PyIterReturn::Return(ch.to_pyobject(vm))); } } internal.0.status = Exhausted; } Ok(PyIterReturn::StopIteration(None)) } } #[derive(FromArgs)] pub struct StrArgs { #[pyarg(any, optional)] object: OptionalArg<PyObjectRef>, #[pyarg(any, optional)] encoding: OptionalArg<PyStrRef>, #[pyarg(any, optional)] errors: OptionalArg<PyStrRef>, } impl Constructor for PyStr { type Args = StrArgs; fn py_new(cls: PyTypeRef, args: Self::Args, vm: &VirtualMachine) -> PyResult { let string: PyStrRef = match args.object { OptionalArg::Present(input) => { if let OptionalArg::Present(enc) = args.encoding { vm.state.codec_registry.decode_text( input, enc.as_str(), args.errors.into_option(), vm, )? } else { input.str(vm)? } } OptionalArg::Missing => { PyStr::from(String::new()).into_ref_with_type(vm, cls.clone())? } }; if string.class().is(&cls) { Ok(string.into()) } else { PyStr::from(string.as_str()) .into_ref_with_type(vm, cls) .map(Into::into) } } } impl PyStr { /// # Safety: Given `bytes` must be valid data for given `kind` pub(crate) unsafe fn new_str_unchecked(bytes: Vec<u8>, kind: PyStrKind) -> Self { let s = Self { bytes: bytes.into_boxed_slice(), kind: kind.new_data(), hash: Radium::new(hash::SENTINEL), }; debug_assert!(matches!(s.kind, PyStrKindData::Ascii) || !s.as_str().is_ascii()); s } /// # Safety /// Given `bytes` must be ascii pub unsafe fn new_ascii_unchecked(bytes: Vec<u8>) -> Self { Self::new_str_unchecked(bytes, PyStrKind::Ascii) } pub fn new_ref(zelf: impl Into<Self>, ctx: &Context) -> PyRef<Self> { let zelf = zelf.into(); PyRef::new_ref(zelf, ctx.types.str_type.to_owned(), None) } fn new_substr(&self, s: String) -> Self { let kind = if self.kind.kind() == PyStrKind::Ascii || s.is_ascii() { PyStrKind::Ascii } else { PyStrKind::Utf8 }; unsafe { // SAFETY: kind is properly decided for substring Self::new_str_unchecked(s.into_bytes(), kind) } } #[inline] pub fn as_str(&self) -> &str { unsafe { // SAFETY: Both PyStrKind::{Ascii, Utf8} are valid utf8 string std::str::from_utf8_unchecked(&self.bytes) } } fn char_all<F>(&self, test: F) -> bool where F: Fn(char) -> bool, { match self.kind.kind() { PyStrKind::Ascii => self.bytes.iter().all(|&x| test(char::from(x))), PyStrKind::Utf8 => self.as_str().chars().all(test), } } fn borrow(&self) -> &BorrowedStr { unsafe { std::mem::transmute(self) } } fn repeat(zelf: PyRef<Self>, value: isize, vm: &VirtualMachine) -> PyResult<PyRef<Self>> { if value == 0 && zelf.class().is(vm.ctx.types.str_type) { // Special case: when some `str` is multiplied by `0`, // returns the empty `str`. return Ok(vm.ctx.empty_str.to_owned()); } if (value == 1 || zelf.is_empty()) && zelf.class().is(vm.ctx.types.str_type) { // Special case: when some `str` is multiplied by `1` or is the empty `str`, // nothing really happens, we need to return an object itself // with the same `id()` to be compatible with CPython. // This only works for `str` itself, not its subclasses. return Ok(zelf); } zelf.as_str() .as_bytes() .mul(vm, value) .map(|x| Self::from(unsafe { String::from_utf8_unchecked(x) }).into_ref(&vm.ctx)) } } #[pyclass( flags(BASETYPE), with( PyRef, AsMapping, AsNumber, AsSequence, Representable, Hashable, Comparable, Iterable, Constructor ) )] impl PyStr { #[pymethod(magic)] fn add(zelf: PyRef<Self>, other: PyObjectRef, vm: &VirtualMachine) -> PyResult { if let Some(other) = other.payload::<PyStr>() { let bytes = zelf.as_str().py_add(other.as_ref()); Ok(unsafe { // SAFETY: `kind` is safely decided let kind = zelf.kind.kind() | other.kind.kind(); Self::new_str_unchecked(bytes.into_bytes(), kind) } .to_pyobject(vm)) } else if let Some(radd) = vm.get_method(other.clone(), identifier!(vm, __radd__)) { // hack to get around not distinguishing number add from seq concat radd?.call((zelf,), vm) } else { Err(vm.new_type_error(format!( "can only concatenate str (not \"{}\") to str", other.class().name() ))) } } #[pymethod(magic)] fn bool(&self) -> bool { !self.bytes.is_empty() } fn _contains(&self, needle: &PyObject, vm: &VirtualMachine) -> PyResult<bool> { if let Some(needle) = needle.payload::<Self>() { Ok(self.as_str().contains(needle.as_str())) } else { Err(vm.new_type_error(format!( "'in <string>' requires string as left operand, not {}", needle.class().name() ))) } } #[pymethod(magic)] fn contains(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult<bool> { self._contains(&needle, vm) } fn _getitem(&self, needle: &PyObject, vm: &VirtualMachine) -> PyResult { match SequenceIndex::try_from_borrowed_object(vm, needle, "str")? { SequenceIndex::Int(i) => self.getitem_by_index(vm, i).map(|x| x.to_string()), SequenceIndex::Slice(slice) => self.getitem_by_slice(vm, slice), } .map(|x| self.new_substr(x).into_ref(&vm.ctx).into()) } #[pymethod(magic)] fn getitem(&self, needle: PyObjectRef, vm: &VirtualMachine) -> PyResult { self._getitem(&needle, vm) } #[inline] pub(crate) fn hash(&self, vm: &VirtualMachine) -> hash::PyHash { match self.hash.load(atomic::Ordering::Relaxed) { hash::SENTINEL => self._compute_hash(vm), hash => hash, } } #[cold] fn _compute_hash(&self, vm: &VirtualMachine) -> hash::PyHash { let hash_val = vm.state.hash_secret.hash_str(self.as_str()); debug_assert_ne!(hash_val, hash::SENTINEL); // like with char_len, we don't need a cmpxchg loop, since it'll always be the same value self.hash.store(hash_val, atomic::Ordering::Relaxed); hash_val } #[inline] pub fn byte_len(&self) -> usize { self.bytes.len() } #[inline] pub fn is_empty(&self) -> bool { self.bytes.is_empty() } #[pymethod(name = "__len__")] #[inline] pub fn char_len(&self) -> usize { self.borrow().char_len() } #[pymethod(name = "isascii")] #[inline(always)] pub fn is_ascii(&self) -> bool { match self.kind { PyStrKindData::Ascii => true, PyStrKindData::Utf8(_) => false, } } #[pymethod(magic)] fn sizeof(&self) -> usize { std::mem::size_of::<Self>() + self.byte_len() * std::mem::size_of::<u8>() } #[pymethod(name = "__rmul__")] #[pymethod(magic)] fn mul(zelf: PyRef<Self>, value: ArgSize, vm: &VirtualMachine) -> PyResult<PyRef<Self>> { Self::repeat(zelf, value.into(), vm) } #[inline] pub(crate) fn repr(&self, vm: &VirtualMachine) -> PyResult<String> { use crate::literal::escape::UnicodeEscape; let escape = UnicodeEscape::new_repr(self.as_str()); escape .str_repr() .to_string() .ok_or_else(|| vm.new_overflow_error("string is too long to generate repr".to_owned())) } #[pymethod] fn lower(&self) -> String { match self.kind.kind() { PyStrKind::Ascii => self.as_str().to_ascii_lowercase(), PyStrKind::Utf8 => self.as_str().to_lowercase(), } } // casefold is much more aggressive than lower #[pymethod] fn casefold(&self) -> String { caseless::default_case_fold_str(self.as_str()) } #[pymethod] fn upper(&self) -> String { match self.kind.kind() { PyStrKind::Ascii => self.as_str().to_ascii_uppercase(), PyStrKind::Utf8 => self.as_str().to_uppercase(), } } #[pymethod] fn capitalize(&self) -> String { let mut chars = self.as_str().chars(); if let Some(first_char) = chars.next() { format!( "{}{}", first_char.to_uppercase(), &chars.as_str().to_lowercase(), ) } else { "".to_owned() } } #[pymethod] fn split(&self, args: SplitArgs, vm: &VirtualMachine) -> PyResult<Vec<PyObjectRef>> { let elements = match self.kind.kind() { PyStrKind::Ascii => self.as_str().py_split( args, vm, |v, s, vm| { v.as_bytes() .split_str(s) .map(|s| { unsafe { PyStr::new_ascii_unchecked(s.to_owned()) }.to_pyobject(vm) }) .collect() }, |v, s, n, vm| { v.as_bytes() .splitn_str(n, s) .map(|s| { unsafe { PyStr::new_ascii_unchecked(s.to_owned()) }.to_pyobject(vm) }) .collect() }, |v, n, vm| { v.as_bytes().py_split_whitespace(n, |s| { unsafe { PyStr::new_ascii_unchecked(s.to_owned()) }.to_pyobject(vm) }) }, ), PyStrKind::Utf8 => self.as_str().py_split( args, vm, |v, s, vm| v.split(s).map(|s| vm.ctx.new_str(s).into()).collect(), |v, s, n, vm| v.splitn(n, s).map(|s| vm.ctx.new_str(s).into()).collect(), |v, n, vm| v.py_split_whitespace(n, |s| vm.ctx.new_str(s).into()), ), }?; Ok(elements) } #[pymethod] fn rsplit(&self, args: SplitArgs, vm: &VirtualMachine) -> PyResult<Vec<PyObjectRef>> { let mut elements = self.as_str().py_split( args, vm, |v, s, vm| v.rsplit(s).map(|s| vm.ctx.new_str(s).into()).collect(), |v, s, n, vm| v.rsplitn(n, s).map(|s| vm.ctx.new_str(s).into()).collect(), |v, n, vm| v.py_rsplit_whitespace(n, |s| vm.ctx.new_str(s).into()), )?; // Unlike Python rsplit, Rust rsplitn returns an iterator that // starts from the end of the string. elements.reverse(); Ok(elements) } #[pymethod] fn strip(&self, chars: OptionalOption<PyStrRef>) -> String { self.as_str() .py_strip( chars, |s, chars| s.trim_matches(|c| chars.contains(c)), |s| s.trim(), ) .to_owned() } #[pymethod] fn lstrip( zelf: PyRef<Self>, chars: OptionalOption<PyStrRef>, vm: &VirtualMachine, ) -> PyRef<Self> { let s = zelf.as_str(); let stripped = s.py_strip( chars, |s, chars| s.trim_start_matches(|c| chars.contains(c)), |s| s.trim_start(), ); if s == stripped { zelf } else { vm.ctx.new_str(stripped) } } #[pymethod] fn rstrip( zelf: PyRef<Self>, chars: OptionalOption<PyStrRef>, vm: &VirtualMachine, ) -> PyRef<Self> { let s = zelf.as_str(); let stripped = s.py_strip( chars, |s, chars| s.trim_end_matches(|c| chars.contains(c)), |s| s.trim_end(), ); if s == stripped { zelf } else { vm.ctx.new_str(stripped) } } #[pymethod] fn endswith(&self, options: anystr::StartsEndsWithArgs, vm: &VirtualMachine) -> PyResult<bool> { let (affix, substr) = match options.prepare(self.as_str(), self.len(), |s, r| s.get_chars(r)) { Some(x) => x, None => return Ok(false), }; substr.py_startsendswith( &affix, "endswith", "str", |s, x: &Py<PyStr>| s.ends_with(x.as_str()), vm, ) } #[pymethod] fn startswith( &self, options: anystr::StartsEndsWithArgs, vm: &VirtualMachine, ) -> PyResult<bool> { let (affix, substr) = match options.prepare(self.as_str(), self.len(), |s, r| s.get_chars(r)) { Some(x) => x, None => return Ok(false), }; substr.py_startsendswith( &affix, "startswith", "str", |s, x: &Py<PyStr>| s.starts_with(x.as_str()), vm, ) } /// Return a str with the given prefix string removed if present. /// /// If the string starts with the prefix string, return string[len(prefix):] /// Otherwise, return a copy of the original string. #[pymethod] fn removeprefix(&self, pref: PyStrRef) -> String { self.as_str() .py_removeprefix(pref.as_str(), pref.byte_len(), |s, p| s.starts_with(p)) .to_owned() } /// Return a str with the given suffix string removed if present. /// /// If the string ends with the suffix string, return string[:len(suffix)] /// Otherwise, return a copy of the original string. #[pymethod] fn removesuffix(&self, suffix: PyStrRef) -> String { self.as_str() .py_removesuffix(suffix.as_str(), suffix.byte_len(), |s, p| s.ends_with(p)) .to_owned() } #[pymethod] fn isalnum(&self) -> bool { !self.bytes.is_empty() && self.char_all(char::is_alphanumeric) } #[pymethod] fn isnumeric(&self) -> bool { !self.bytes.is_empty() && self.char_all(char::is_numeric) } #[pymethod] fn isdigit(&self) -> bool { // python's isdigit also checks if exponents are digits, these are the unicode codepoints for exponents let valid_codepoints: [u16; 10] = [ 0x2070, 0x00B9, 0x00B2, 0x00B3, 0x2074, 0x2075, 0x2076, 0x2077, 0x2078, 0x2079, ]; let s = self.as_str(); !s.is_empty() && s.chars() .filter(|c| !c.is_ascii_digit()) .all(|c| valid_codepoints.contains(&(c as u16))) } #[pymethod] fn isdecimal(&self) -> bool { !self.bytes.is_empty() && self.char_all(|c| GeneralCategory::of(c) == GeneralCategory::DecimalNumber) } #[pymethod(name = "__mod__")] fn modulo(&self, values: PyObjectRef, vm: &VirtualMachine) -> PyResult<String> { let formatted = self.as_str().py_cformat(values, vm)?; Ok(formatted) } #[pymethod(magic)] fn rmod(&self, _values: PyObjectRef, vm: &VirtualMachine) -> PyObjectRef { vm.ctx.not_implemented() } #[pymethod] fn format(&self, args: FuncArgs, vm: &VirtualMachine) -> PyResult<String> { let format_str = FormatString::from_str(self.as_str()).map_err(|e| e.to_pyexception(vm))?; format(&format_str, &args, vm) } /// S.format_map(mapping) -> str /// /// Return a formatted version of S, using substitutions from mapping. /// The substitutions are identified by braces ('{' and '}'). #[pymethod] fn format_map(&self, mapping: PyObjectRef, vm: &VirtualMachine) -> PyResult<String> { let format_string = FormatString::from_str(self.as_str()).map_err(|err| err.to_pyexception(vm))?; format_map(&format_string, &mapping, vm) } #[pymethod(name = "__format__")] fn __format__(zelf: PyRef<Self>, spec: PyStrRef, vm: &VirtualMachine) -> PyResult<PyStrRef> { let spec = spec.as_str(); if spec.is_empty() { return if zelf.class().is(vm.ctx.types.str_type) { Ok(zelf) } else { zelf.as_object().str(vm) }; } let s = FormatSpec::parse(spec) .and_then(|format_spec| format_spec.format_string(zelf.borrow())) .map_err(|err| err.into_pyexception(vm))?; Ok(vm.ctx.new_str(s)) } /// Return a titlecased version of the string where words start with an /// uppercase character and the remaining characters are lowercase. #[pymethod] fn title(&self) -> String { let mut title = String::with_capacity(self.bytes.len()); let mut previous_is_cased = false; for c in self.as_str().chars() { if c.is_lowercase() { if !previous_is_cased { title.extend(c.to_titlecase()); } else { title.push(c); } previous_is_cased = true; } else if c.is_uppercase() || c.is_titlecase() { if previous_is_cased { title.extend(c.to_lowercase()); } else { title.push(c); } previous_is_cased = true; } else { previous_is_cased = false; title.push(c); } } title } #[pymethod] fn swapcase(&self) -> String { let mut swapped_str = String::with_capacity(self.bytes.len()); for c in self.as_str().chars() { // to_uppercase returns an iterator, to_ascii_uppercase returns the char if c.is_lowercase() { swapped_str.push(c.to_ascii_uppercase()); } else if c.is_uppercase() { swapped_str.push(c.to_ascii_lowercase()); } else { swapped_str.push(c); } } swapped_str } #[pymethod] fn isalpha(&self) -> bool { !self.bytes.is_empty() && self.char_all(char::is_alphabetic) } #[pymethod] fn replace(&self, old: PyStrRef, new: PyStrRef, count: OptionalArg<isize>) -> String { let s = self.as_str(); match count { OptionalArg::Present(max_count) if max_count >= 0 => { if max_count == 0 || (s.is_empty() && !old.is_empty()) { // nothing to do; return the original bytes s.to_owned() } else if s.is_empty() && old.is_empty() { new.as_str().to_owned() } else { s.replacen(old.as_str(), new.as_str(), max_count as usize) } } _ => s.replace(old.as_str(), new.as_str()), } } /// Return true if all characters in the string are printable or the string is empty, /// false otherwise. Nonprintable characters are those characters defined in the /// Unicode character database as `Other` or `Separator`, /// excepting the ASCII space (0x20) which is considered printable. /// /// All characters except those characters defined in the Unicode character /// database as following categories are considered printable. /// * Cc (Other, Control) /// * Cf (Other, Format) /// * Cs (Other, Surrogate) /// * Co (Other, Private Use) /// * Cn (Other, Not Assigned) /// * Zl Separator, Line ('\u2028', LINE SEPARATOR) /// * Zp Separator, Paragraph ('\u2029', PARAGRAPH SEPARATOR) /// * Zs (Separator, Space) other than ASCII space('\x20'). #[pymethod] fn isprintable(&self) -> bool { self.char_all(|c| c == '\u{0020}' || rustpython_literal::char::is_printable(c)) } #[pymethod] fn isspace(&self) -> bool { use unic_ucd_bidi::bidi_class::abbr_names::*; !self.bytes.is_empty() && self.char_all(|c| { GeneralCategory::of(c) == GeneralCategory::SpaceSeparator || matches!(BidiClass::of(c), WS | B | S) }) } // Return true if all cased characters in the string are lowercase and there is at least one cased character, false otherwise. #[pymethod] fn islower(&self) -> bool { match self.kind.kind() { PyStrKind::Ascii => self.bytes.py_iscase(char::is_lowercase, char::is_uppercase), PyStrKind::Utf8 => self .as_str() .py_iscase(char::is_lowercase, char::is_uppercase), } } // Return true if all cased characters in the string are uppercase and there is at least one cased character, false otherwise. #[pymethod] fn isupper(&self) -> bool { match self.kind.kind() { PyStrKind::Ascii => self.bytes.py_iscase(char::is_uppercase, char::is_lowercase), PyStrKind::Utf8 => self .as_str() .py_iscase(char::is_uppercase, char::is_lowercase), } } #[pymethod] fn splitlines(&self, args: anystr::SplitLinesArgs, vm: &VirtualMachine) -> Vec<PyObjectRef> { let into_wrapper = |s: &str| self.new_substr(s.to_owned()).to_pyobject(vm); let mut elements = Vec::new(); let mut last_i = 0; let self_str = self.as_str(); let mut enumerated = self_str.char_indices().peekable(); while let Some((i, ch)) = enumerated.next() { let end_len = match ch { '\n' => 1, '\r' => { let is_rn = enumerated.peek().map_or(false, |(_, ch)| *ch == '\n'); if is_rn { let _ = enumerated.next(); 2 } else { 1 } } '\x0b' | '\x0c' | '\x1c' | '\x1d' | '\x1e' | '\u{0085}' | '\u{2028}' | '\u{2029}' => ch.len_utf8(), _ => { continue; } }; let range = if args.keepends { last_i..i + end_len } else { last_i..i }; last_i = i + end_len; elements.push(into_wrapper(&self_str[range])); } if last_i != self_str.len() { elements.push(into_wrapper(&self_str[last_i..])); } elements } #[pymethod] fn join( zelf: PyRef<Self>, iterable: ArgIterable<PyStrRef>, vm: &VirtualMachine, ) -> PyResult<PyStrRef> { let iter = iterable.iter(vm)?; let joined = match iter.exactly_one() { Ok(first) => { let first = first?; if first.as_object().class().is(vm.ctx.types.str_type) { return Ok(first); } else { first.as_str().to_owned() } } Err(iter) => zelf.as_str().py_join(iter)?, }; Ok(vm.ctx.new_str(joined)) } // FIXME: two traversals of str is expensive #[inline] fn _to_char_idx(r: &str, byte_idx: usize) -> usize { r[..byte_idx].chars().count() } #[inline] fn _find<F>(&self, args: FindArgs, find: F) -> Option<usize> where F: Fn(&str, &str) -> Option<usize>, { let (sub, range) = args.get_value(self.len()); self.as_str().py_find(sub.as_str(), range, find) } #[pymethod] fn find(&self, args: FindArgs) -> isize { self._find(args, |r, s| Some(Self::_to_char_idx(r, r.find(s)?))) .map_or(-1, |v| v as isize) } #[pymethod] fn rfind(&self, args: FindArgs) -> isize { self._find(args, |r, s| Some(Self::_to_char_idx(r, r.rfind(s)?))) .map_or(-1, |v| v as isize) } #[pymethod] fn index(&self, args: FindArgs, vm: &VirtualMachine) -> PyResult<usize> { self._find(args, |r, s| Some(Self::_to_char_idx(r, r.find(s)?))) .ok_or_else(|| vm.new_value_error("substring not found".to_owned())) } #[pymethod] fn rindex(&self, args: FindArgs, vm: &VirtualMachine) -> PyResult<usize> { self._find(args, |r, s| Some(Self::_to_char_idx(r, r.rfind(s)?))) .ok_or_else(|| vm.new_value_error("substring not found".to_owned())) } #[pymethod] fn partition(&self, sep: PyStrRef, vm: &VirtualMachine) -> PyResult { let (front, has_mid, back) = self.as_str().py_partition( sep.as_str(), || self.as_str().splitn(2, sep.as_str()), vm, )?; let partition = ( self.new_substr(front), if has_mid { sep } else { vm.ctx.new_str(ascii!("")) }, self.new_substr(back), ); Ok(partition.to_pyobject(vm)) } #[pymethod] fn rpartition(&self, sep: PyStrRef, vm: &VirtualMachine) -> PyResult { let (back, has_mid, front) = self.as_str().py_partition( sep.as_str(), || self.as_str().rsplitn(2, sep.as_str()), vm, )?; Ok(( self.new_substr(front), if has_mid { sep } else { vm.ctx.new_str(ascii!("")) }, self.new_substr(back), ) .to_pyobject(vm)) } /// Return `true` if the sequence is ASCII titlecase and the sequence is not /// empty, `false` otherwise. #[pymethod] fn istitle(&self) -> bool { if self.bytes.is_empty() { return false; } let mut cased = false; let mut previous_is_cased = false; for c in self.as_str().chars() { if c.is_uppercase() || c.is_titlecase() { if previous_is_cased { return false; } previous_is_cased = true; cased = true; } else if c.is_lowercase() { if !previous_is_cased { return false; } previous_is_cased = true; cased = true; } else { previous_is_cased = false; } } cased } #[pymethod] fn count(&self, args: FindArgs) -> usize { let (needle, range) = args.get_value(self.len()); self.as_str() .py_count(needle.as_str(), range, |h, n| h.matches(n).count()) } #[pymethod] fn zfill(&self, width: isize) -> String { unsafe { // SAFETY: this is safe-guaranteed because the original self.as_str() is valid utf8 String::from_utf8_unchecked(self.as_str().py_zfill(width)) } } #[inline] fn _pad( &self, width: isize, fillchar: OptionalArg<PyStrRef>, pad: fn(&str, usize, char, usize) -> String, vm: &VirtualMachine, ) -> PyResult<String> { let fillchar = fillchar.map_or(Ok(' '), |ref s| { s.as_str().chars().exactly_one().map_err(|_| { vm.new_type_error( "The fill character must be exactly one character long".to_owned(), ) }) })?; Ok(if self.len() as isize >= width { String::from(self.as_str()) } else { pad(self.as_str(), width as usize, fillchar, self.len()) }) } #[pymethod] fn center( &self, width: isize, fillchar: OptionalArg<PyStrRef>, vm: &VirtualMachine, ) -> PyResult<String> { self._pad(width, fillchar, AnyStr::py_center, vm) } #[pymethod] fn ljust( &self, width: isize, fillchar: OptionalArg<PyStrRef>, vm: &VirtualMachine, ) -> PyResult<String> { self._pad(width, fillchar, AnyStr::py_ljust, vm) } #[pymethod] fn rjust( &self, width: isize, fillchar: OptionalArg<PyStrRef>, vm: &VirtualMachine, ) -> PyResult<String> { self._pad(width, fillchar, AnyStr::py_rjust, vm) } #[pymethod] fn expandtabs(&self, args: anystr::ExpandTabsArgs) -> String { let tab_stop = args.tabsize(); let mut expanded_str = String::with_capacity(self.byte_len()); let mut tab_size = tab_stop; let mut col_count = 0usize; for ch in self.as_str().chars() { match ch { '\t' => { let num_spaces = tab_size - col_count; col_count += num_spaces; let expand = " ".repeat(num_spaces); expanded_str.push_str(&expand); } '\r' | '\n' => { expanded_str.push(ch); col_count = 0; tab_size = 0; } _ => { expanded_str.push(ch); col_count += 1; } } if col_count >= tab_size { tab_size += tab_stop; } } expanded_str } #[pymethod] fn isidentifier(&self) -> bool { let mut chars = self.as_str().chars(); let is_identifier_start = chars.next().map_or(false, |c| c == '_' || is_xid_start(c)); // a string is not an identifier if it has whitespace or starts with a number is_identifier_start && chars.all(is_xid_continue) } // https://docs.python.org/3/library/stdtypes.html#str.translate #[pymethod] fn translate(&self, table: PyObjectRef, vm: &VirtualMachine) -> PyResult<String> { vm.get_method_or_type_error(table.clone(), identifier!(vm, __getitem__), || { format!("'{}' object is not subscriptable", table.class().name()) })?; let mut translated = String::new(); for c in self.as_str().chars() { match table.get_item(&*(c as u32).to_pyobject(vm), vm) { Ok(value) => { if let Some(text) = value.payload::<PyStr>() { translated.push_str(text.as_str()); } else if let Some(bigint) = value.payload::<PyInt>() { let ch = bigint .as_bigint() .to_u32() .and_then(std::char::from_u32) .ok_or_else(|| { vm.new_value_error( "character mapping must be in range(0x110000)".to_owned(), ) })?; translated.push(ch); } else if !vm.is_none(&value) { return Err(vm.new_type_error( "character mapping must return integer, None or str".to_owned(), )); } } _ => translated.push(c), } } Ok(translated) } #[pystaticmethod] fn maketrans( dict_or_str: PyObjectRef, to_str: OptionalArg<PyStrRef>, none_str: OptionalArg<PyStrRef>, vm: &VirtualMachine, ) -> PyResult { let new_dict = vm.ctx.new_dict(); if let OptionalArg::Present(to_str) = to_str { match dict_or_str.downcast::<PyStr>() { Ok(from_str) => { if to_str.len() == from_str.len() { for (c1, c2) in from_str.as_str().chars().zip(to_str.as_str().chars()) { new_dict.set_item( &*vm.new_pyobj(c1 as u32), vm.new_pyobj(c2 as u32), vm, )?; } if let OptionalArg::Present(none_str) = none_str { for c in none_str.as_str().chars() { new_dict.set_item(&*vm.new_pyobj(c as u32), vm.ctx.none(), vm)?; } } Ok(new_dict.to_pyobject(vm)) } else { Err(vm.new_value_error( "the first two maketrans arguments must have equal length".to_owned(), )) } } _ => Err(vm.new_type_error( "first maketrans argument must be a string if there is a second argument" .to_owned(), )), } } else { // dict_str must be a dict match dict_or_str.downcast::<PyDict>() { Ok(dict) => { for (key, val) in dict { // FIXME: ints are key-compatible if let Some(num) = key.payload::<PyInt>() { new_dict.set_item( &*num.as_bigint().to_i32().to_pyobject(vm), val, vm, )?; } else if let Some(string) = key.payload::<PyStr>() { if string.len() == 1 { let num_value = string.as_str().chars().next().unwrap() as u32; new_dict.set_item(&*num_value.to_pyobject(vm), val, vm)?; } else { return Err(vm.new_value_error( "string keys in translate table must be of length 1".to_owned(), )); } } } Ok(new_dict.to_pyobject(vm)) } _ => Err(vm.new_value_error( "if you give only one argument to maketrans it must be a dict".to_owned(), )), } } } #[pymethod] fn encode(zelf: PyRef<Self>, args: EncodeArgs, vm: &VirtualMachine) -> PyResult<PyBytesRef> { encode_string(zelf, args.encoding, args.errors, vm) } #[pymethod(magic)] fn getnewargs(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyObjectRef { (zelf.as_str(),).to_pyobject(vm) } } #[pyclass] impl PyRef<PyStr> { #[pymethod(magic)] fn str(self, vm: &VirtualMachine) -> PyRefExact<PyStr> { self.into_exact_or(&vm.ctx, |zelf| unsafe { // Creating a copy with same kind is safe PyStr::new_str_unchecked(zelf.bytes.to_vec(), zelf.kind.kind()).into_exact_ref(&vm.ctx) }) } } impl PyStrRef { pub fn concat_in_place(&mut self, other: &str, vm: &VirtualMachine) { // TODO: call [A]Rc::get_mut on the str to try to mutate the data in place if other.is_empty() { return; } let mut s = String::with_capacity(self.byte_len() + other.len()); s.push_str(self.as_ref()); s.push_str(other); *self = PyStr::from(s).into_ref(&vm.ctx); } } impl Representable for PyStr { #[inline] fn repr_str(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<String> { zelf.repr(vm) } } impl Hashable for PyStr { #[inline] fn hash(zelf: &Py<Self>, vm: &VirtualMachine) -> PyResult<hash::PyHash> { Ok(zelf.hash(vm)) } } impl Comparable for PyStr { fn cmp( zelf: &Py<Self>, other: &PyObject, op: PyComparisonOp, _vm: &VirtualMachine, ) -> PyResult<PyComparisonValue> { if let Some(res) = op.identical_optimization(zelf, other) { return Ok(res.into()); } let other = class_or_notimplemented!(Self, other); Ok(op.eval_ord(zelf.as_str().cmp(other.as_str())).into()) } } impl Iterable for PyStr { fn iter(zelf: PyRef<Self>, vm: &VirtualMachine) -> PyResult { Ok(PyStrIterator { internal: PyMutex::new((PositionIterInternal::new(zelf, 0), 0)), } .into_pyobject(vm)) } } impl AsMapping for PyStr { fn as_mapping() -> &'static PyMappingMethods { static AS_MAPPING: Lazy<PyMappingMethods> = Lazy::new(|| PyMappingMethods { length: atomic_func!(|mapping, _vm| Ok(PyStr::mapping_downcast(mapping).len())), subscript: atomic_func!( |mapping, needle, vm| PyStr::mapping_downcast(mapping)._getitem(needle, vm) ), ..PyMappingMethods::NOT_IMPLEMENTED }); &AS_MAPPING } } impl AsNumber for PyStr { fn as_number() -> &'static PyNumberMethods { static AS_NUMBER: PyNumberMethods = PyNumberMethods { remainder: Some(|a, b, vm| { if let Some(a) = a.downcast_ref::<PyStr>() { a.modulo(b.to_owned(), vm).to_pyresult(vm) } else { Ok(vm.ctx.not_implemented()) } }), ..PyNumberMethods::NOT_IMPLEMENTED }; &AS_NUMBER } } impl AsSequence for PyStr { fn as_sequence() -> &'static PySequenceMethods { static AS_SEQUENCE: Lazy<PySequenceMethods> = Lazy::new(|| PySequenceMethods { length: atomic_func!(|seq, _vm| Ok(PyStr::sequence_downcast(seq).len())), concat: atomic_func!(|seq, other, vm| { let zelf = PyStr::sequence_downcast(seq); PyStr::add(zelf.to_owned(), other.to_owned(), vm) }), repeat: atomic_func!(|seq, n, vm| { let zelf = PyStr::sequence_downcast(seq); PyStr::repeat(zelf.to_owned(), n, vm).map(|x| x.into()) }), item: atomic_func!(|seq, i, vm| { let zelf = PyStr::sequence_downcast(seq); zelf.getitem_by_index(vm, i) .map(|x| zelf.new_substr(x.to_string()).into_ref(&vm.ctx).into()) }), contains: atomic_func!( |seq, needle, vm| PyStr::sequence_downcast(seq)._contains(needle, vm) ), ..PySequenceMethods::NOT_IMPLEMENTED }); &AS_SEQUENCE } } #[derive(FromArgs)] struct EncodeArgs { #[pyarg(any, default)] encoding: Option<PyStrRef>, #[pyarg(any, default)] errors: Option<PyStrRef>, } pub(crate) fn encode_string( s: PyStrRef, encoding: Option<PyStrRef>, errors: Option<PyStrRef>, vm: &VirtualMachine, ) -> PyResult<PyBytesRef> { let encoding = encoding .as_ref() .map_or(crate::codecs::DEFAULT_ENCODING, |s| s.as_str()); vm.state.codec_registry.encode_text(s, encoding, errors, vm) } impl PyPayload for PyStr { fn class(ctx: &Context) -> &'static Py<PyType> { ctx.types.str_type } } impl ToPyObject for String { fn to_pyobject(self, vm: &VirtualMachine) -> PyObjectRef { vm.ctx.new_str(self).into() } } impl ToPyObject for char { fn to_pyobject(self, vm: &VirtualMachine) -> PyObjectRef { vm.ctx.new_str(self.to_string()).into() } } impl ToPyObject for &str { fn to_pyobject(self, vm: &VirtualMachine) -> PyObjectRef { vm.ctx.new_str(self).into() } } impl ToPyObject for &String { fn to_pyobject(self, vm: &VirtualMachine) -> PyObjectRef { vm.ctx.new_str(self.clone()).into() } } impl ToPyObject for &AsciiStr { fn to_pyobject(self, vm: &VirtualMachine) -> PyObjectRef { vm.ctx.new_str(self).into() } } impl ToPyObject for AsciiString { fn to_pyobject(self, vm: &VirtualMachine) -> PyObjectRef { vm.ctx.new_str(self).into() } } type SplitArgs = anystr::SplitArgs<PyStrRef>; #[derive(FromArgs)] pub struct FindArgs { #[pyarg(positional)] sub: PyStrRef, #[pyarg(positional, default)] start: Option<PyIntRef>, #[pyarg(positional, default)] end: Option<PyIntRef>, } impl FindArgs { fn get_value(self, len: usize) -> (PyStrRef, std::ops::Range<usize>) { let range = adjust_indices(self.start, self.end, len); (self.sub, range) } } pub fn init(ctx: &Context) { PyStr::extend_class(ctx, ctx.types.str_type); PyStrIterator::extend_class(ctx, ctx.types.str_iterator_type); } impl SliceableSequenceOp for PyStr { type Item = char; type Sliced = String; fn do_get(&self, index: usize) -> Self::Item { if self.is_ascii() { self.bytes[index] as char } else { self.as_str().chars().nth(index).unwrap() } } fn do_slice(&self, range: Range<usize>) -> Self::Sliced { let value = self.as_str(); if self.is_ascii() { value[range].to_owned() } else { rustpython_common::str::get_chars(value, range).to_owned() } } fn do_slice_reverse(&self, range: Range<usize>) -> Self::Sliced { if self.is_ascii() { // this is an ascii string let mut v = self.bytes[range].to_vec(); v.reverse(); unsafe { // SAFETY: an ascii string is always utf8 String::from_utf8_unchecked(v) } } else { let mut s = String::with_capacity(self.bytes.len()); s.extend( self.as_str() .chars() .rev() .skip(self.char_len() - range.end) .take(range.end - range.start), ); s } } fn do_stepped_slice(&self, range: Range<usize>, step: usize) -> Self::Sliced { if self.is_ascii() { let v = self.bytes[range].iter().copied().step_by(step).collect(); unsafe { // SAFETY: Any subset of ascii string is a valid utf8 string String::from_utf8_unchecked(v) } } else { let mut s = String::with_capacity(2 * ((range.len() / step) + 1)); s.extend( self.as_str() .chars() .skip(range.start) .take(range.end - range.start) .step_by(step), ); s } } fn do_stepped_slice_reverse(&self, range: Range<usize>, step: usize) -> Self::Sliced { if self.is_ascii() { // this is an ascii string let v: Vec<u8> = self.bytes[range] .iter() .rev() .copied() .step_by(step) .collect(); // TODO: from_utf8_unchecked? String::from_utf8(v).unwrap() } else { // not ascii, so the codepoints have to be at least 2 bytes each let mut s = String::with_capacity(2 * ((range.len() / step) + 1)); s.extend( self.as_str() .chars() .rev() .skip(self.char_len() - range.end) .take(range.end - range.start) .step_by(step), ); s } } fn empty() -> Self::Sliced { String::new() } fn len(&self) -> usize { self.char_len() } } impl AsRef<str> for PyRefExact<PyStr> { fn as_ref(&self) -> &str { self.as_str() } } impl AsRef<str> for PyExact<PyStr> { fn as_ref(&self) -> &str { self.as_str() } } #[cfg(test)] mod tests { use super::*; use crate::Interpreter; #[test] fn str_title() { let tests = vec![ (" Hello ", " hello "), ("Hello ", "hello "), ("Hello ", "Hello "), ("Format This As Title String", "fOrMaT thIs aS titLe String"), ("Format,This-As*Title;String", "fOrMaT,thIs-aS*titLe;String"), ("Getint", "getInt"), ("Greek Ωppercases ...", "greek ωppercases ..."), ("Greek ῼitlecases ...", "greek ῳitlecases ..."), ]; for (title, input) in tests { assert_eq!(PyStr::from(input).title().as_str(), title); } } #[test] fn str_istitle() { let pos = vec![ "A", "A Titlecased Line", "A\nTitlecased Line", "A Titlecased, Line", "Greek Ωppercases ...", "Greek ῼitlecases ...", ]; for s in pos { assert!(PyStr::from(s).istitle()); } let neg = vec![ "", "a", "\n", "Not a capitalized String", "Not\ta Titlecase String", "Not--a Titlecase String", "NOT", ]; for s in neg { assert!(!PyStr::from(s).istitle()); } } #[test] fn str_maketrans_and_translate() { Interpreter::without_stdlib(Default::default()).enter(|vm| { let table = vm.ctx.new_dict(); table .set_item("a", vm.ctx.new_str("🎅").into(), vm) .unwrap(); table.set_item("b", vm.ctx.none(), vm).unwrap(); table .set_item("c", vm.ctx.new_str(ascii!("xda")).into(), vm) .unwrap(); let translated = PyStr::maketrans(table.into(), OptionalArg::Missing, OptionalArg::Missing, vm) .unwrap(); let text = PyStr::from("abc"); let translated = text.translate(translated, vm).unwrap(); assert_eq!(translated, "🎅xda".to_owned()); let translated = text.translate(vm.ctx.new_int(3).into(), vm); assert_eq!("TypeError", &*translated.unwrap_err().class().name(),); }) } } impl AnyStrWrapper for PyStrRef { type Str = str; fn as_ref(&self) -> &str { self.as_str() } } impl AnyStrContainer<str> for String { fn new() -> Self { String::new() } fn with_capacity(capacity: usize) -> Self { String::with_capacity(capacity) } fn push_str(&mut self, other: &str) { String::push_str(self, other) } } impl AnyStr for str { type Char = char; type Container = String; type CharIter<'a> = std::str::Chars<'a>; type ElementIter<'a> = std::str::Chars<'a>; fn element_bytes_len(c: char) -> usize { c.len_utf8() } fn to_container(&self) -> Self::Container { self.to_owned() } fn as_bytes(&self) -> &[u8] { self.as_bytes() } fn as_utf8_str(&self) -> Result<&str, std::str::Utf8Error> { Ok(self) } fn chars(&self) -> Self::CharIter<'_> { str::chars(self) } fn elements(&self) -> Self::ElementIter<'_> { str::chars(self) } fn get_bytes(&self, range: std::ops::Range<usize>) -> &Self { &self[range] } fn get_chars(&self, range: std::ops::Range<usize>) -> &Self { rustpython_common::str::get_chars(self, range) } fn is_empty(&self) -> bool { Self::is_empty(self) } fn bytes_len(&self) -> usize { Self::len(self) } fn py_split_whitespace<F>(&self, maxsplit: isize, convert: F) -> Vec<PyObjectRef> where F: Fn(&Self) -> PyObjectRef, { // CPython split_whitespace let mut splits = Vec::new(); let mut last_offset = 0; let mut count = maxsplit; for (offset, _) in self.match_indices(|c: char| c.is_ascii_whitespace() || c == '\x0b') { if last_offset == offset { last_offset += 1; continue; } if count == 0 { break; } splits.push(convert(&self[last_offset..offset])); last_offset = offset + 1; count -= 1; } if last_offset != self.len() { splits.push(convert(&self[last_offset..])); } splits } fn py_rsplit_whitespace<F>(&self, maxsplit: isize, convert: F) -> Vec<PyObjectRef> where F: Fn(&Self) -> PyObjectRef, { // CPython rsplit_whitespace let mut splits = Vec::new(); let mut last_offset = self.len(); let mut count = maxsplit; for (offset, _) in self.rmatch_indices(|c: char| c.is_ascii_whitespace() || c == '\x0b') { if last_offset == offset + 1 { last_offset -= 1; continue; } if count == 0 { break; } splits.push(convert(&self[offset + 1..last_offset])); last_offset = offset; count -= 1; } if last_offset != 0 { splits.push(convert(&self[..last_offset])); } splits } } /// The unique reference of interned PyStr /// Always intended to be used as a static reference pub type PyStrInterned = PyInterned<PyStr>; impl PyStrInterned { #[inline] pub fn to_exact(&'static self) -> PyRefExact<PyStr> { unsafe { PyRefExact::new_unchecked(self.to_owned()) } } } impl std::fmt::Display for PyStrInterned { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.as_str(), f) } } impl AsRef<str> for PyStrInterned { #[inline(always)] fn as_ref(&self) -> &str { self.as_str() } }
#![feature(test)] extern crate test; extern crate password_maker_lib; use test::test::Bencher; use password_maker_lib::create_package; #[cfg(not(debug_assertions))] #[bench] fn create_package_bench(b: &mut Bencher) -> () { let length = 1000; let amount = 1000; b.iter(|| { let mut passwords = create_package(&length, &amount); //tests are bugged atm, .len() does not return the correct value assert_eq!(passwords.len(),amount); assert_eq!(passwords.last().unwrap().len(), length); }); }
use std::env; use telegram_bot::{Error, Api, GetMe}; #[tokio::main] async fn main() -> Result<(), Error> { dotenv::dotenv().ok(); let token = env::var("TOKEN").expect("TOKEN is not set"); let api = Api::new(token); let result = api.send(GetMe).await?; println!("{:?}", result); Ok(()) }
//! Test suite for the Web and headless browsers. #![cfg(target_arch = "wasm32")] extern crate wasm_bindgen_test; use pine::runtime::InputVal; use pine_ws::*; use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; // wasm_bindgen_test_configure!(run_in_browser); #[wasm_bindgen_test] fn runner_test() { init_panic_hook(); // assert_eq!(1 + 1, 2); let mut runner = new_runner(); assert_eq!( parse_src( &mut runner, String::from("m = input(1, 'hello', 'int')\nplot(close + m)") ), Ok(()) ); assert!(gen_io_info(&mut runner).is_ok()); let input_data: Vec<f64> = vec![0f64, 0f64, 0f64, 0f64]; assert!(run_with_data( &mut runner, JsValue::from_serde(&vec!["close", "open", "high", "low"]).unwrap(), 1, input_data.clone().into_boxed_slice().as_mut(), JsValue::NULL, ) .is_ok()); let input_vals: Vec<Option<InputVal>> = vec![Some(InputVal::Int(1))]; assert!(run_with_input(&mut runner, JsValue::from_serde(&input_vals).unwrap()).is_ok()); assert!(run( &mut runner, JsValue::from_serde(&input_vals).unwrap(), JsValue::from_serde(&vec!["close", "open", "high", "low"]).unwrap(), 1, input_data.clone().into_boxed_slice().as_mut(), JsValue::NULL, ) .is_ok()); assert!(update( &mut runner, JsValue::from_serde(&vec!["close", "open", "high", "low"]).unwrap(), 1, input_data.clone().into_boxed_slice().as_mut() ) .is_ok()); assert!(update_from( &mut runner, JsValue::from_serde(&vec!["close", "open", "high", "low"]).unwrap(), 0, 1, input_data.clone().into_boxed_slice().as_mut() ) .is_ok()); } #[wasm_bindgen_test] fn runner_simple_test() { init_panic_hook(); // assert_eq!(1 + 1, 2); let mut runner = new_runner(); assert_eq!(parse_src(&mut runner, String::from("plot(close)")), Ok(())); assert!(gen_io_info(&mut runner).is_ok()); } #[wasm_bindgen_test] fn volume_test() { init_panic_hook(); // assert_eq!(1 + 1, 2); let mut runner = new_runner(); assert_eq!(parse_src(&mut runner, String::from("plot(volume)")), Ok(())); assert!(gen_io_info(&mut runner).is_ok()); let input_data: Vec<f64> = vec![10f64]; let result = run_with_data( &mut runner, JsValue::from_serde(&vec!["volume"]).unwrap(), 1, input_data.into_boxed_slice().as_mut(), JsValue::NULL, ); assert!(result.is_ok()); if let Ok(output) = result { let mut out_data = output_array_get(&output, 0); let vec = unsafe { Vec::from_raw_parts(output_series(&mut out_data), 3, 3) }; assert_eq!(vec, vec![1f64, 1f64, 10f64]); } } #[wasm_bindgen_test] fn timenow_test() { init_panic_hook(); // assert_eq!(1 + 1, 2); let mut runner = new_runner(); assert_eq!( parse_src(&mut runner, String::from("int a = timenow\nplot(a)")), Ok(()) ); assert!(gen_io_info(&mut runner).is_ok()); }
use std::env; use std::fs::File; use std::io::{self, BufRead, BufReader}; fn parse_bus_notes(text: &str) -> (i64, Vec<&str>) { let mut lines = text.lines(); let arrival = lines .next() .expect("text arrival line failed") .parse::<i64>() .expect("text arrival line NaN"); let bus_row = lines.next().expect("text bus line failed"); let bus_lines = bus_row.split(",").collect::<Vec<&str>>(); return (arrival, bus_lines); } fn part1(arrival: i64, bus_lines: Vec<&str>) -> i64 { let mut fastest = i64::MAX; let mut fastest_id = 0; for bus in bus_lines { if bus == "x" { continue; } let id = bus .parse::<i64>() .expect(&format!("bus parse failed: {} NaN", bus)); let mut next_arrival = id; while next_arrival < arrival { next_arrival += id; } if next_arrival < fastest { fastest = next_arrival; fastest_id = id; } } let wait_time = fastest - arrival; return fastest_id * wait_time; } fn part2(bus_lines: Vec<&str>) -> i64 { let len = bus_lines.len() as i64; let mut bus_list = Vec::new(); let mut gap_list = Vec::new(); for (i, bus) in bus_lines.into_iter().enumerate() { if bus == "x" { continue; } let id = bus .parse::<i64>() .expect(&format!("bus_parse falied: {} NaN", bus)); bus_list.push(id); gap_list.push(len - (len + i as i64)); } let time: i64 = bus_list.iter().product(); println!("{:?}", bus_list); println!("{:?}", gap_list); println!("{:?}", time); return 0; } fn main() -> Result<(), io::Error> { let args: Vec<String> = env::args().collect(); let text = std::fs::read_to_string(&args[1])?; let (arrival, bus_lines) = parse_bus_notes(&text); if &args[2] == "1" { println!("{}", part1(arrival, bus_lines)); } else if &args[2] == "2" { println!("{}", part2(bus_lines)); } Ok(()) } #[cfg(test)] mod tests { use super::*; #[test] fn test_part1() { let text = String::from("939\n7,13,x,x,59,x,31,19"); let (arrival, bus_lines) = parse_bus_notes(&text); assert_eq!(arrival, 939); assert_eq!(part1(arrival, bus_lines), 295); } #[test] fn test_part2() { let text = String::from("939\n7,13,x,x,59,x,31,19"); let (arrival, bus_lines) = parse_bus_notes(&text); assert_eq!(arrival, 939); assert_eq!(part2(bus_lines), 1068788); /* let text = String::from("939\n17,x,13,19"); let (arrival, bus_lines) = parse_bus_notes(&text); assert_eq!(arrival, 939); assert_eq!(part2(bus_lines), 3417); let text = String::from("939\n67,7,59,61"); let (arrival, bus_lines) = parse_bus_notes(&text); assert_eq!(arrival, 939); assert_eq!(part2(bus_lines), 754018); let text = String::from("939\n67,x,7,59,61"); let (arrival, bus_lines) = parse_bus_notes(&text); assert_eq!(arrival, 939); assert_eq!(part2(bus_lines), 779210); let text = String::from("939\n67,7,x,59,61"); let (arrival, bus_lines) = parse_bus_notes(&text); assert_eq!(arrival, 939); assert_eq!(part2(bus_lines), 1261476); let text = String::from("939\n1789,37,47,1889"); let (arrival, bus_lines) = parse_bus_notes(&text); assert_eq!(arrival, 939); assert_eq!(part2(bus_lines), 1202161486); assert_eq!(true, false); */ } }
use samplecli::*; use clap::{App, Arg}; fn main() { println!("Hello, world!"); let app = App::new("sample cli") .version("0.1.0") // バージョン情報 .author("myname <myname@mail.com>") // 作者情報 .about("Clap Example CLI") // このアプリについて .arg( Arg::with_name("flg") // フラグを定義 .help("sample flag") // ヘルプメッセージ .short("f") // ショートコマンド .long("flag"), // ロングコマンド ) .arg( Arg::with_name("opt") // オプションを定義 .help("sample option") // ヘルプメッセージ .short("o") // ショートコマンド .long("opt") // ロングコマンド .takes_value(true), // 値を持つことを定義 ); let matches = app.get_matches(); // optが指定されていれば値を表示 if let Some(o) = matches.value_of("opt") { println!("Value for opt: {}", o); } // flgのON/OFFで表示するメッセージを切り替え println!( "flg is {}", if matches.is_present("flg") { "ON" } else { "OFF" } ); input!{ n: usize, m: usize, }; println!("{}", n); }
//! Provides a plugin for Nickel's Request which allows the raw contents //! of a body to be made available via the req.raw_body() method. // // I found it on the internet: https://github.com/nickel-org/nickel.rs/issues/359 extern crate plugin; extern crate typemap; use std::io; use std::io::Read; use nickel::Request; use self::typemap::Key; use self::plugin::{Plugin, Pluggable}; struct RawBodyPlugin; pub trait RawBody { fn raw_body(&mut self) -> &str; } impl Key for RawBodyPlugin { type Value = String; } impl<'mw, 'conn, D> Plugin<Request<'mw, 'conn, D>> for RawBodyPlugin { type Error = io::Error; fn eval(req: &mut Request<D>) -> Result<String, io::Error> { let mut buffer = String::new(); try!(req.origin.read_to_string(&mut buffer)); Ok(buffer) } } impl<'mw, 'conn, D> RawBody for Request<'mw, 'conn, D> { fn raw_body(&mut self) -> &str { match self.get_ref::<RawBodyPlugin>().ok() { Some(x) => x, None => "", } } }
// 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::marker::PhantomData; use std::sync::Arc; use common_exception::Result; use common_expression::BlockMetaInfo; use common_expression::BlockMetaInfoDowncast; use common_expression::DataBlock; use common_pipeline_core::processors::port::InputPort; use common_pipeline_core::processors::port::OutputPort; use common_pipeline_core::processors::processor::Event; use common_pipeline_core::processors::Processor; // TODO: maybe we also need async transform for `SELECT sleep(1)`? pub trait Transform: Send { const NAME: &'static str; const SKIP_EMPTY_DATA_BLOCK: bool = false; fn transform(&mut self, data: DataBlock) -> Result<DataBlock>; fn name(&self) -> String { Self::NAME.to_string() } fn on_start(&mut self) -> Result<()> { Ok(()) } fn on_finish(&mut self) -> Result<()> { Ok(()) } } pub struct Transformer<T: Transform + 'static> { transform: T, input: Arc<InputPort>, output: Arc<OutputPort>, called_on_start: bool, called_on_finish: bool, input_data: Option<DataBlock>, output_data: Option<DataBlock>, } impl<T: Transform + 'static> Transformer<T> { pub fn create(input: Arc<InputPort>, output: Arc<OutputPort>, inner: T) -> Box<dyn Processor> { Box::new(Self { input, output, transform: inner, input_data: None, output_data: None, called_on_start: false, called_on_finish: false, }) } } #[async_trait::async_trait] impl<T: Transform + 'static> Processor for Transformer<T> { fn name(&self) -> String { Transform::name(&self.transform) } fn as_any(&mut self) -> &mut dyn Any { self } fn event(&mut self) -> Result<Event> { if !self.called_on_start { return Ok(Event::Sync); } match self.output.is_finished() { true => self.finish_input(), false if !self.output.can_push() => self.not_need_data(), false => match self.output_data.take() { None if self.input_data.is_some() => Ok(Event::Sync), None => self.pull_data(), Some(data) => { self.output.push_data(Ok(data)); Ok(Event::NeedConsume) } }, } } fn process(&mut self) -> Result<()> { if !self.called_on_start { self.called_on_start = true; self.transform.on_start()?; return Ok(()); } if let Some(data_block) = self.input_data.take() { let data_block = self.transform.transform(data_block)?; self.output_data = Some(data_block); return Ok(()); } if !self.called_on_finish { self.called_on_finish = true; self.transform.on_finish()?; } Ok(()) } } impl<T: Transform> Transformer<T> { fn pull_data(&mut self) -> Result<Event> { if self.input.has_data() { self.input_data = Some(self.input.pull_data().unwrap()?); return Ok(Event::Sync); } if self.input.is_finished() { return match !self.called_on_finish { true => Ok(Event::Sync), false => { self.output.finish(); Ok(Event::Finished) } }; } self.input.set_need_data(); Ok(Event::NeedData) } fn not_need_data(&mut self) -> Result<Event> { self.input.set_not_need_data(); Ok(Event::NeedConsume) } fn finish_input(&mut self) -> Result<Event> { match !self.called_on_finish { true => Ok(Event::Sync), false => { self.input.finish(); Ok(Event::Finished) } } } } // Transform for block meta and ignoring the block columns. pub trait BlockMetaTransform<B: BlockMetaInfo>: Send + 'static { const NAME: &'static str; fn transform(&mut self, meta: B) -> Result<DataBlock>; fn on_start(&mut self) -> Result<()> { Ok(()) } fn on_finish(&mut self) -> Result<()> { Ok(()) } } pub struct BlockMetaTransformer<B: BlockMetaInfo, T: BlockMetaTransform<B>> { transform: T, input: Arc<InputPort>, output: Arc<OutputPort>, called_on_start: bool, called_on_finish: bool, input_data: Option<DataBlock>, output_data: Option<DataBlock>, _phantom_data: PhantomData<B>, } impl<B: BlockMetaInfo, T: BlockMetaTransform<B>> BlockMetaTransformer<B, T> { pub fn create(input: Arc<InputPort>, output: Arc<OutputPort>, inner: T) -> Box<dyn Processor> { Box::new(Self { input, output, transform: inner, input_data: None, output_data: None, called_on_start: false, called_on_finish: false, _phantom_data: Default::default(), }) } } #[async_trait::async_trait] impl<B: BlockMetaInfo, T: BlockMetaTransform<B>> Processor for BlockMetaTransformer<B, T> { fn name(&self) -> String { String::from(T::NAME) } fn as_any(&mut self) -> &mut dyn Any { self } fn event(&mut self) -> Result<Event> { if !self.called_on_start { return Ok(Event::Sync); } match self.output.is_finished() { true => self.finish_input(), false if !self.output.can_push() => self.not_need_data(), false => match self.output_data.take() { None if self.input_data.is_some() => Ok(Event::Sync), None => self.pull_data(), Some(data) => { self.output.push_data(Ok(data)); Ok(Event::NeedConsume) } }, } } fn process(&mut self) -> Result<()> { if !self.called_on_start { self.called_on_start = true; self.transform.on_start()?; return Ok(()); } if let Some(mut data_block) = self.input_data.take() { debug_assert!(data_block.is_empty()); if let Some(block_meta) = data_block.take_meta() { if let Some(block_meta) = B::downcast_from(block_meta) { let data_block = self.transform.transform(block_meta)?; self.output_data = Some(data_block); } } return Ok(()); } if !self.called_on_finish { self.called_on_finish = true; self.transform.on_finish()?; } Ok(()) } } impl<B: BlockMetaInfo, T: BlockMetaTransform<B>> BlockMetaTransformer<B, T> { fn pull_data(&mut self) -> Result<Event> { if self.input.has_data() { self.input_data = Some(self.input.pull_data().unwrap()?); return Ok(Event::Sync); } if self.input.is_finished() { return match !self.called_on_finish { true => Ok(Event::Sync), false => { self.output.finish(); Ok(Event::Finished) } }; } self.input.set_need_data(); Ok(Event::NeedData) } fn not_need_data(&mut self) -> Result<Event> { self.input.set_not_need_data(); Ok(Event::NeedConsume) } fn finish_input(&mut self) -> Result<Event> { match !self.called_on_finish { true => Ok(Event::Sync), false => { self.input.finish(); Ok(Event::Finished) } } } }
#[doc = "Reader of register CONTIM"] pub type R = crate::R<u8, super::CONTIM>; #[doc = "Writer for register CONTIM"] pub type W = crate::W<u8, super::CONTIM>; #[doc = "Register CONTIM `reset()`'s with value 0"] impl crate::ResetValue for super::CONTIM { type Type = u8; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `WTID`"] pub type WTID_R = crate::R<u8, u8>; #[doc = "Write proxy for field `WTID`"] pub struct WTID_W<'a> { w: &'a mut W, } impl<'a> WTID_W<'a> { #[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 & !0x0f) | ((value as u8) & 0x0f); self.w } } #[doc = "Reader of field `WTCON`"] pub type WTCON_R = crate::R<u8, u8>; #[doc = "Write proxy for field `WTCON`"] pub struct WTCON_W<'a> { w: &'a mut W, } impl<'a> WTCON_W<'a> { #[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 & !(0x0f << 4)) | (((value as u8) & 0x0f) << 4); self.w } } impl R { #[doc = "Bits 0:3 - Wait ID"] #[inline(always)] pub fn wtid(&self) -> WTID_R { WTID_R::new((self.bits & 0x0f) as u8) } #[doc = "Bits 4:7 - Connect Wait"] #[inline(always)] pub fn wtcon(&self) -> WTCON_R { WTCON_R::new(((self.bits >> 4) & 0x0f) as u8) } } impl W { #[doc = "Bits 0:3 - Wait ID"] #[inline(always)] pub fn wtid(&mut self) -> WTID_W { WTID_W { w: self } } #[doc = "Bits 4:7 - Connect Wait"] #[inline(always)] pub fn wtcon(&mut self) -> WTCON_W { WTCON_W { w: self } } }
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Media_Core_Preview")] pub mod Preview; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct AudioDecoderDegradation(pub i32); impl AudioDecoderDegradation { pub const None: AudioDecoderDegradation = AudioDecoderDegradation(0i32); pub const DownmixTo2Channels: AudioDecoderDegradation = AudioDecoderDegradation(1i32); pub const DownmixTo6Channels: AudioDecoderDegradation = AudioDecoderDegradation(2i32); pub const DownmixTo8Channels: AudioDecoderDegradation = AudioDecoderDegradation(3i32); } impl ::core::convert::From<i32> for AudioDecoderDegradation { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for AudioDecoderDegradation { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for AudioDecoderDegradation { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.AudioDecoderDegradation;i4)"); } impl ::windows::core::DefaultType for AudioDecoderDegradation { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct AudioDecoderDegradationReason(pub i32); impl AudioDecoderDegradationReason { pub const None: AudioDecoderDegradationReason = AudioDecoderDegradationReason(0i32); pub const LicensingRequirement: AudioDecoderDegradationReason = AudioDecoderDegradationReason(1i32); pub const SpatialAudioNotSupported: AudioDecoderDegradationReason = AudioDecoderDegradationReason(2i32); } impl ::core::convert::From<i32> for AudioDecoderDegradationReason { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for AudioDecoderDegradationReason { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for AudioDecoderDegradationReason { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.AudioDecoderDegradationReason;i4)"); } impl ::windows::core::DefaultType for AudioDecoderDegradationReason { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AudioStreamDescriptor(pub ::windows::core::IInspectable); impl AudioStreamDescriptor { #[cfg(feature = "Media_MediaProperties")] pub fn EncodingProperties(&self) -> ::windows::core::Result<super::MediaProperties::AudioEncodingProperties> { 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::<super::MediaProperties::AudioEncodingProperties>(result__) } } pub fn IsSelected(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(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 SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(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__) } } #[cfg(feature = "Media_MediaProperties")] pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, super::MediaProperties::AudioEncodingProperties>>(encodingproperties: Param0) -> ::windows::core::Result<AudioStreamDescriptor> { Self::IAudioStreamDescriptorFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), encodingproperties.into_param().abi(), &mut result__).from_abi::<AudioStreamDescriptor>(result__) }) } #[cfg(feature = "Foundation")] pub fn SetLeadingEncoderPadding<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<u32>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IAudioStreamDescriptor2>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn LeadingEncoderPadding(&self) -> ::windows::core::Result<super::super::Foundation::IReference<u32>> { let this = &::windows::core::Interface::cast::<IAudioStreamDescriptor2>(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::Foundation::IReference<u32>>(result__) } } #[cfg(feature = "Foundation")] pub fn SetTrailingEncoderPadding<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<u32>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IAudioStreamDescriptor2>(self)?; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn TrailingEncoderPadding(&self) -> ::windows::core::Result<super::super::Foundation::IReference<u32>> { let this = &::windows::core::Interface::cast::<IAudioStreamDescriptor2>(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::Foundation::IReference<u32>>(result__) } } pub fn SetLabel<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor2>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Label(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor2>(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 Copy(&self) -> ::windows::core::Result<AudioStreamDescriptor> { let this = &::windows::core::Interface::cast::<IAudioStreamDescriptor3>(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::<AudioStreamDescriptor>(result__) } } pub fn IAudioStreamDescriptorFactory<R, F: FnOnce(&IAudioStreamDescriptorFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<AudioStreamDescriptor, IAudioStreamDescriptorFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for AudioStreamDescriptor { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.AudioStreamDescriptor;{1e3692e4-4027-4847-a70b-df1d9a2a7b04})"); } unsafe impl ::windows::core::Interface for AudioStreamDescriptor { type Vtable = IAudioStreamDescriptor_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1e3692e4_4027_4847_a70b_df1d9a2a7b04); } impl ::windows::core::RuntimeName for AudioStreamDescriptor { const NAME: &'static str = "Windows.Media.Core.AudioStreamDescriptor"; } impl ::core::convert::From<AudioStreamDescriptor> for ::windows::core::IUnknown { fn from(value: AudioStreamDescriptor) -> Self { value.0 .0 } } impl ::core::convert::From<&AudioStreamDescriptor> for ::windows::core::IUnknown { fn from(value: &AudioStreamDescriptor) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AudioStreamDescriptor { 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 AudioStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AudioStreamDescriptor> for ::windows::core::IInspectable { fn from(value: AudioStreamDescriptor) -> Self { value.0 } } impl ::core::convert::From<&AudioStreamDescriptor> for ::windows::core::IInspectable { fn from(value: &AudioStreamDescriptor) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AudioStreamDescriptor { 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 AudioStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<AudioStreamDescriptor> for IMediaStreamDescriptor { type Error = ::windows::core::Error; fn try_from(value: AudioStreamDescriptor) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&AudioStreamDescriptor> for IMediaStreamDescriptor { type Error = ::windows::core::Error; fn try_from(value: &AudioStreamDescriptor) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor> for AudioStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor> for &AudioStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor> { ::core::convert::TryInto::<IMediaStreamDescriptor>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } impl ::core::convert::TryFrom<AudioStreamDescriptor> for IMediaStreamDescriptor2 { type Error = ::windows::core::Error; fn try_from(value: AudioStreamDescriptor) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&AudioStreamDescriptor> for IMediaStreamDescriptor2 { type Error = ::windows::core::Error; fn try_from(value: &AudioStreamDescriptor) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor2> for AudioStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor2> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor2> for &AudioStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor2> { ::core::convert::TryInto::<IMediaStreamDescriptor2>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for AudioStreamDescriptor {} unsafe impl ::core::marker::Sync for AudioStreamDescriptor {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AudioTrack(pub ::windows::core::IInspectable); impl AudioTrack { pub fn Id(&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 Language(&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 TrackKind(&self) -> ::windows::core::Result<MediaTrackKind> { let this = self; unsafe { let mut result__: MediaTrackKind = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MediaTrackKind>(result__) } } pub fn SetLabel<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Label(&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__) } } #[cfg(feature = "Foundation")] pub fn OpenFailed<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<AudioTrack, AudioTrackOpenFailedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = &::windows::core::Interface::cast::<IAudioTrack>(self)?; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveOpenFailed<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IAudioTrack>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Media_MediaProperties")] pub fn GetEncodingProperties(&self) -> ::windows::core::Result<super::MediaProperties::AudioEncodingProperties> { let this = &::windows::core::Interface::cast::<IAudioTrack>(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::MediaProperties::AudioEncodingProperties>(result__) } } #[cfg(feature = "Media_Playback")] pub fn PlaybackItem(&self) -> ::windows::core::Result<super::Playback::MediaPlaybackItem> { let this = &::windows::core::Interface::cast::<IAudioTrack>(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::Playback::MediaPlaybackItem>(result__) } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IAudioTrack>(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 SupportInfo(&self) -> ::windows::core::Result<AudioTrackSupportInfo> { let this = &::windows::core::Interface::cast::<IAudioTrack>(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::<AudioTrackSupportInfo>(result__) } } } unsafe impl ::windows::core::RuntimeType for AudioTrack { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.AudioTrack;{03e1fafc-c931-491a-b46b-c10ee8c256b7})"); } unsafe impl ::windows::core::Interface for AudioTrack { type Vtable = IMediaTrack_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x03e1fafc_c931_491a_b46b_c10ee8c256b7); } impl ::windows::core::RuntimeName for AudioTrack { const NAME: &'static str = "Windows.Media.Core.AudioTrack"; } impl ::core::convert::From<AudioTrack> for ::windows::core::IUnknown { fn from(value: AudioTrack) -> Self { value.0 .0 } } impl ::core::convert::From<&AudioTrack> for ::windows::core::IUnknown { fn from(value: &AudioTrack) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AudioTrack { 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 AudioTrack { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AudioTrack> for ::windows::core::IInspectable { fn from(value: AudioTrack) -> Self { value.0 } } impl ::core::convert::From<&AudioTrack> for ::windows::core::IInspectable { fn from(value: &AudioTrack) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AudioTrack { 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 AudioTrack { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<AudioTrack> for IMediaTrack { fn from(value: AudioTrack) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&AudioTrack> for IMediaTrack { fn from(value: &AudioTrack) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IMediaTrack> for AudioTrack { fn into_param(self) -> ::windows::core::Param<'a, IMediaTrack> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IMediaTrack> for &AudioTrack { fn into_param(self) -> ::windows::core::Param<'a, IMediaTrack> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for AudioTrack {} unsafe impl ::core::marker::Sync for AudioTrack {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AudioTrackOpenFailedEventArgs(pub ::windows::core::IInspectable); impl AudioTrackOpenFailedEventArgs { pub fn ExtendedError(&self) -> ::windows::core::Result<::windows::core::HRESULT> { let this = self; unsafe { let mut result__: ::windows::core::HRESULT = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HRESULT>(result__) } } } unsafe impl ::windows::core::RuntimeType for AudioTrackOpenFailedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.AudioTrackOpenFailedEventArgs;{eeddb9b9-bb7c-4112-bf76-9384676f824b})"); } unsafe impl ::windows::core::Interface for AudioTrackOpenFailedEventArgs { type Vtable = IAudioTrackOpenFailedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xeeddb9b9_bb7c_4112_bf76_9384676f824b); } impl ::windows::core::RuntimeName for AudioTrackOpenFailedEventArgs { const NAME: &'static str = "Windows.Media.Core.AudioTrackOpenFailedEventArgs"; } impl ::core::convert::From<AudioTrackOpenFailedEventArgs> for ::windows::core::IUnknown { fn from(value: AudioTrackOpenFailedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&AudioTrackOpenFailedEventArgs> for ::windows::core::IUnknown { fn from(value: &AudioTrackOpenFailedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AudioTrackOpenFailedEventArgs { 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 AudioTrackOpenFailedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AudioTrackOpenFailedEventArgs> for ::windows::core::IInspectable { fn from(value: AudioTrackOpenFailedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&AudioTrackOpenFailedEventArgs> for ::windows::core::IInspectable { fn from(value: &AudioTrackOpenFailedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AudioTrackOpenFailedEventArgs { 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 AudioTrackOpenFailedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for AudioTrackOpenFailedEventArgs {} unsafe impl ::core::marker::Sync for AudioTrackOpenFailedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct AudioTrackSupportInfo(pub ::windows::core::IInspectable); impl AudioTrackSupportInfo { pub fn DecoderStatus(&self) -> ::windows::core::Result<MediaDecoderStatus> { let this = self; unsafe { let mut result__: MediaDecoderStatus = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MediaDecoderStatus>(result__) } } pub fn Degradation(&self) -> ::windows::core::Result<AudioDecoderDegradation> { let this = self; unsafe { let mut result__: AudioDecoderDegradation = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<AudioDecoderDegradation>(result__) } } pub fn DegradationReason(&self) -> ::windows::core::Result<AudioDecoderDegradationReason> { let this = self; unsafe { let mut result__: AudioDecoderDegradationReason = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<AudioDecoderDegradationReason>(result__) } } pub fn MediaSourceStatus(&self) -> ::windows::core::Result<MediaSourceStatus> { let this = self; unsafe { let mut result__: MediaSourceStatus = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MediaSourceStatus>(result__) } } } unsafe impl ::windows::core::RuntimeType for AudioTrackSupportInfo { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.AudioTrackSupportInfo;{178beff7-cc39-44a6-b951-4a5653f073fa})"); } unsafe impl ::windows::core::Interface for AudioTrackSupportInfo { type Vtable = IAudioTrackSupportInfo_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x178beff7_cc39_44a6_b951_4a5653f073fa); } impl ::windows::core::RuntimeName for AudioTrackSupportInfo { const NAME: &'static str = "Windows.Media.Core.AudioTrackSupportInfo"; } impl ::core::convert::From<AudioTrackSupportInfo> for ::windows::core::IUnknown { fn from(value: AudioTrackSupportInfo) -> Self { value.0 .0 } } impl ::core::convert::From<&AudioTrackSupportInfo> for ::windows::core::IUnknown { fn from(value: &AudioTrackSupportInfo) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for AudioTrackSupportInfo { 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 AudioTrackSupportInfo { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<AudioTrackSupportInfo> for ::windows::core::IInspectable { fn from(value: AudioTrackSupportInfo) -> Self { value.0 } } impl ::core::convert::From<&AudioTrackSupportInfo> for ::windows::core::IInspectable { fn from(value: &AudioTrackSupportInfo) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for AudioTrackSupportInfo { 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 AudioTrackSupportInfo { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for AudioTrackSupportInfo {} unsafe impl ::core::marker::Sync for AudioTrackSupportInfo {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ChapterCue(pub ::windows::core::IInspectable); impl ChapterCue { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ChapterCue, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation")] pub fn SetStartTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn StartTime(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDuration<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Duration(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } pub fn SetId<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Id(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaCue>(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 SetTitle<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Title(&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__) } } } unsafe impl ::windows::core::RuntimeType for ChapterCue { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.ChapterCue;{72a98001-d38a-4c0a-8fa6-75cddaf4664c})"); } unsafe impl ::windows::core::Interface for ChapterCue { type Vtable = IChapterCue_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x72a98001_d38a_4c0a_8fa6_75cddaf4664c); } impl ::windows::core::RuntimeName for ChapterCue { const NAME: &'static str = "Windows.Media.Core.ChapterCue"; } impl ::core::convert::From<ChapterCue> for ::windows::core::IUnknown { fn from(value: ChapterCue) -> Self { value.0 .0 } } impl ::core::convert::From<&ChapterCue> for ::windows::core::IUnknown { fn from(value: &ChapterCue) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ChapterCue { 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 ChapterCue { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ChapterCue> for ::windows::core::IInspectable { fn from(value: ChapterCue) -> Self { value.0 } } impl ::core::convert::From<&ChapterCue> for ::windows::core::IInspectable { fn from(value: &ChapterCue) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ChapterCue { 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 ChapterCue { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<ChapterCue> for IMediaCue { type Error = ::windows::core::Error; fn try_from(value: ChapterCue) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&ChapterCue> for IMediaCue { type Error = ::windows::core::Error; fn try_from(value: &ChapterCue) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaCue> for ChapterCue { fn into_param(self) -> ::windows::core::Param<'a, IMediaCue> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaCue> for &ChapterCue { fn into_param(self) -> ::windows::core::Param<'a, IMediaCue> { ::core::convert::TryInto::<IMediaCue>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for ChapterCue {} unsafe impl ::core::marker::Sync for ChapterCue {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct CodecCategory(pub i32); impl CodecCategory { pub const Encoder: CodecCategory = CodecCategory(0i32); pub const Decoder: CodecCategory = CodecCategory(1i32); } impl ::core::convert::From<i32> for CodecCategory { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for CodecCategory { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for CodecCategory { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.CodecCategory;i4)"); } impl ::windows::core::DefaultType for CodecCategory { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct CodecInfo(pub ::windows::core::IInspectable); impl CodecInfo { pub fn Kind(&self) -> ::windows::core::Result<CodecKind> { let this = self; unsafe { let mut result__: CodecKind = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<CodecKind>(result__) } } pub fn Category(&self) -> ::windows::core::Result<CodecCategory> { let this = self; unsafe { let mut result__: CodecCategory = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<CodecCategory>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Subtypes(&self) -> ::windows::core::Result<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).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVectorView<::windows::core::HSTRING>>(result__) } } pub fn DisplayName(&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 IsTrusted(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } } unsafe impl ::windows::core::RuntimeType for CodecInfo { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.CodecInfo;{51e89f85-ea97-499c-86ac-4ce5e73f3a42})"); } unsafe impl ::windows::core::Interface for CodecInfo { type Vtable = ICodecInfo_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x51e89f85_ea97_499c_86ac_4ce5e73f3a42); } impl ::windows::core::RuntimeName for CodecInfo { const NAME: &'static str = "Windows.Media.Core.CodecInfo"; } impl ::core::convert::From<CodecInfo> for ::windows::core::IUnknown { fn from(value: CodecInfo) -> Self { value.0 .0 } } impl ::core::convert::From<&CodecInfo> for ::windows::core::IUnknown { fn from(value: &CodecInfo) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for CodecInfo { 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 CodecInfo { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<CodecInfo> for ::windows::core::IInspectable { fn from(value: CodecInfo) -> Self { value.0 } } impl ::core::convert::From<&CodecInfo> for ::windows::core::IInspectable { fn from(value: &CodecInfo) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for CodecInfo { 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 CodecInfo { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for CodecInfo {} unsafe impl ::core::marker::Sync for CodecInfo {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct CodecKind(pub i32); impl CodecKind { pub const Audio: CodecKind = CodecKind(0i32); pub const Video: CodecKind = CodecKind(1i32); } impl ::core::convert::From<i32> for CodecKind { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for CodecKind { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for CodecKind { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.CodecKind;i4)"); } impl ::windows::core::DefaultType for CodecKind { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct CodecQuery(pub ::windows::core::IInspectable); impl CodecQuery { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<CodecQuery, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub fn FindAllAsync<'a, Param2: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, kind: CodecKind, category: CodecCategory, subtype: Param2) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<super::super::Foundation::Collections::IVectorView<CodecInfo>>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), kind, category, subtype.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<super::super::Foundation::Collections::IVectorView<CodecInfo>>>(result__) } } } unsafe impl ::windows::core::RuntimeType for CodecQuery { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.CodecQuery;{222a953a-af61-4e04-808a-a4634e2f3ac4})"); } unsafe impl ::windows::core::Interface for CodecQuery { type Vtable = ICodecQuery_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x222a953a_af61_4e04_808a_a4634e2f3ac4); } impl ::windows::core::RuntimeName for CodecQuery { const NAME: &'static str = "Windows.Media.Core.CodecQuery"; } impl ::core::convert::From<CodecQuery> for ::windows::core::IUnknown { fn from(value: CodecQuery) -> Self { value.0 .0 } } impl ::core::convert::From<&CodecQuery> for ::windows::core::IUnknown { fn from(value: &CodecQuery) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for CodecQuery { 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 CodecQuery { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<CodecQuery> for ::windows::core::IInspectable { fn from(value: CodecQuery) -> Self { value.0 } } impl ::core::convert::From<&CodecQuery> for ::windows::core::IInspectable { fn from(value: &CodecQuery) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for CodecQuery { 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 CodecQuery { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for CodecQuery {} unsafe impl ::core::marker::Sync for CodecQuery {} pub struct CodecSubtypes {} impl CodecSubtypes { pub fn VideoFormatDV25() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| 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 VideoFormatDV50() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| 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 VideoFormatDvc() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| 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 VideoFormatDvh1() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| 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 VideoFormatDvhD() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| 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 VideoFormatDvsd() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| 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 VideoFormatDvsl() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| 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__) }) } pub fn VideoFormatH263() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatH264() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatH265() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatH264ES() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatHevc() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatHevcES() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatM4S2() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).19)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatMjpg() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).20)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatMP43() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).21)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatMP4S() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).22)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatMP4V() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).23)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatMpeg2() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).24)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatVP80() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).25)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatVP90() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).26)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatMpg1() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).27)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatMss1() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).28)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatMss2() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).29)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatWmv1() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).30)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatWmv2() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).31)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatWmv3() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).32)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormatWvc1() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).33)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn VideoFormat420O() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).34)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatAac() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).35)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatAdts() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).36)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatAlac() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).37)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatAmrNB() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).38)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatAmrWB() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).39)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatAmrWP() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).40)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatDolbyAC3() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).41)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatDolbyAC3Spdif() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).42)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatDolbyDDPlus() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).43)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatDrm() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).44)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatDts() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).45)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatFlac() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).46)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatFloat() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).47)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatMP3() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).48)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatMPeg() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).49)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatMsp1() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).50)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatOpus() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).51)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatPcm() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).52)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatWmaSpdif() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).53)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatWMAudioLossless() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).54)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatWMAudioV8() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).55)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn AudioFormatWMAudioV9() -> ::windows::core::Result<::windows::core::HSTRING> { Self::ICodecSubtypesStatics(|this| unsafe { let mut result__: ::core::mem::ManuallyDrop<::windows::core::HSTRING> = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).56)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) }) } pub fn ICodecSubtypesStatics<R, F: FnOnce(&ICodecSubtypesStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<CodecSubtypes, ICodecSubtypesStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } impl ::windows::core::RuntimeName for CodecSubtypes { const NAME: &'static str = "Windows.Media.Core.CodecSubtypes"; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct DataCue(pub ::windows::core::IInspectable); impl DataCue { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<DataCue, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Storage_Streams")] pub fn SetData<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IBuffer>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Storage_Streams")] pub fn Data(&self) -> ::windows::core::Result<super::super::Storage::Streams::IBuffer> { 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::Storage::Streams::IBuffer>(result__) } } #[cfg(feature = "Foundation")] pub fn SetStartTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn StartTime(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDuration<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Duration(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } pub fn SetId<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Id(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaCue>(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_Collections")] pub fn Properties(&self) -> ::windows::core::Result<super::super::Foundation::Collections::PropertySet> { let this = &::windows::core::Interface::cast::<IDataCue2>(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::<super::super::Foundation::Collections::PropertySet>(result__) } } } unsafe impl ::windows::core::RuntimeType for DataCue { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.DataCue;{7c7f676d-1fbc-4e2d-9a87-ee38bd1dc637})"); } unsafe impl ::windows::core::Interface for DataCue { type Vtable = IDataCue_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7c7f676d_1fbc_4e2d_9a87_ee38bd1dc637); } impl ::windows::core::RuntimeName for DataCue { const NAME: &'static str = "Windows.Media.Core.DataCue"; } impl ::core::convert::From<DataCue> for ::windows::core::IUnknown { fn from(value: DataCue) -> Self { value.0 .0 } } impl ::core::convert::From<&DataCue> for ::windows::core::IUnknown { fn from(value: &DataCue) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for DataCue { 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 DataCue { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<DataCue> for ::windows::core::IInspectable { fn from(value: DataCue) -> Self { value.0 } } impl ::core::convert::From<&DataCue> for ::windows::core::IInspectable { fn from(value: &DataCue) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for DataCue { 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 DataCue { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<DataCue> for IMediaCue { type Error = ::windows::core::Error; fn try_from(value: DataCue) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&DataCue> for IMediaCue { type Error = ::windows::core::Error; fn try_from(value: &DataCue) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaCue> for DataCue { fn into_param(self) -> ::windows::core::Param<'a, IMediaCue> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaCue> for &DataCue { fn into_param(self) -> ::windows::core::Param<'a, IMediaCue> { ::core::convert::TryInto::<IMediaCue>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for DataCue {} unsafe impl ::core::marker::Sync for DataCue {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct FaceDetectedEventArgs(pub ::windows::core::IInspectable); impl FaceDetectedEventArgs { pub fn ResultFrame(&self) -> ::windows::core::Result<FaceDetectionEffectFrame> { 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::<FaceDetectionEffectFrame>(result__) } } } unsafe impl ::windows::core::RuntimeType for FaceDetectedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.FaceDetectedEventArgs;{19918426-c65b-46ba-85f8-13880576c90a})"); } unsafe impl ::windows::core::Interface for FaceDetectedEventArgs { type Vtable = IFaceDetectedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x19918426_c65b_46ba_85f8_13880576c90a); } impl ::windows::core::RuntimeName for FaceDetectedEventArgs { const NAME: &'static str = "Windows.Media.Core.FaceDetectedEventArgs"; } impl ::core::convert::From<FaceDetectedEventArgs> for ::windows::core::IUnknown { fn from(value: FaceDetectedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&FaceDetectedEventArgs> for ::windows::core::IUnknown { fn from(value: &FaceDetectedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for FaceDetectedEventArgs { 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 FaceDetectedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<FaceDetectedEventArgs> for ::windows::core::IInspectable { fn from(value: FaceDetectedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&FaceDetectedEventArgs> for ::windows::core::IInspectable { fn from(value: &FaceDetectedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for FaceDetectedEventArgs { 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 FaceDetectedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for FaceDetectedEventArgs {} unsafe impl ::core::marker::Sync for FaceDetectedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct FaceDetectionEffect(pub ::windows::core::IInspectable); impl FaceDetectionEffect { pub fn SetEnabled(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value).ok() } } pub fn Enabled(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDesiredDetectionInterval<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn DesiredDetectionInterval(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn FaceDetected<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<FaceDetectionEffect, FaceDetectedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveFaceDetected<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn SetProperties<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IPropertySet>>(&self, configuration: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::IMediaExtension>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), configuration.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for FaceDetectionEffect { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.FaceDetectionEffect;{ae15ebd2-0542-42a9-bc90-f283a29f46c1})"); } unsafe impl ::windows::core::Interface for FaceDetectionEffect { type Vtable = IFaceDetectionEffect_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xae15ebd2_0542_42a9_bc90_f283a29f46c1); } impl ::windows::core::RuntimeName for FaceDetectionEffect { const NAME: &'static str = "Windows.Media.Core.FaceDetectionEffect"; } impl ::core::convert::From<FaceDetectionEffect> for ::windows::core::IUnknown { fn from(value: FaceDetectionEffect) -> Self { value.0 .0 } } impl ::core::convert::From<&FaceDetectionEffect> for ::windows::core::IUnknown { fn from(value: &FaceDetectionEffect) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for FaceDetectionEffect { 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 FaceDetectionEffect { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<FaceDetectionEffect> for ::windows::core::IInspectable { fn from(value: FaceDetectionEffect) -> Self { value.0 } } impl ::core::convert::From<&FaceDetectionEffect> for ::windows::core::IInspectable { fn from(value: &FaceDetectionEffect) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for FaceDetectionEffect { 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 FaceDetectionEffect { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<FaceDetectionEffect> for super::IMediaExtension { type Error = ::windows::core::Error; fn try_from(value: FaceDetectionEffect) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&FaceDetectionEffect> for super::IMediaExtension { type Error = ::windows::core::Error; fn try_from(value: &FaceDetectionEffect) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, super::IMediaExtension> for FaceDetectionEffect { fn into_param(self) -> ::windows::core::Param<'a, super::IMediaExtension> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, super::IMediaExtension> for &FaceDetectionEffect { fn into_param(self) -> ::windows::core::Param<'a, super::IMediaExtension> { ::core::convert::TryInto::<super::IMediaExtension>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for FaceDetectionEffect {} unsafe impl ::core::marker::Sync for FaceDetectionEffect {} #[cfg(feature = "Media_Effects")] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct FaceDetectionEffectDefinition(pub ::windows::core::IInspectable); #[cfg(feature = "Media_Effects")] impl FaceDetectionEffectDefinition { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<FaceDetectionEffectDefinition, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Media_Effects")] pub fn ActivatableClassId(&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 = "Media_Effects"))] pub fn Properties(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IPropertySet> { 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::Foundation::Collections::IPropertySet>(result__) } } pub fn SetDetectionMode(&self, value: FaceDetectionMode) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IFaceDetectionEffectDefinition>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value).ok() } } pub fn DetectionMode(&self) -> ::windows::core::Result<FaceDetectionMode> { let this = &::windows::core::Interface::cast::<IFaceDetectionEffectDefinition>(self)?; unsafe { let mut result__: FaceDetectionMode = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<FaceDetectionMode>(result__) } } pub fn SetSynchronousDetectionEnabled(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IFaceDetectionEffectDefinition>(self)?; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value).ok() } } pub fn SynchronousDetectionEnabled(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<IFaceDetectionEffectDefinition>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } } #[cfg(feature = "Media_Effects")] unsafe impl ::windows::core::RuntimeType for FaceDetectionEffectDefinition { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.FaceDetectionEffectDefinition;{39f38cf0-8d0f-4f3e-84fc-2d46a5297943})"); } #[cfg(feature = "Media_Effects")] unsafe impl ::windows::core::Interface for FaceDetectionEffectDefinition { type Vtable = super::Effects::IVideoEffectDefinition_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x39f38cf0_8d0f_4f3e_84fc_2d46a5297943); } #[cfg(feature = "Media_Effects")] impl ::windows::core::RuntimeName for FaceDetectionEffectDefinition { const NAME: &'static str = "Windows.Media.Core.FaceDetectionEffectDefinition"; } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<FaceDetectionEffectDefinition> for ::windows::core::IUnknown { fn from(value: FaceDetectionEffectDefinition) -> Self { value.0 .0 } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<&FaceDetectionEffectDefinition> for ::windows::core::IUnknown { fn from(value: &FaceDetectionEffectDefinition) -> Self { value.0 .0.clone() } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for FaceDetectionEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a FaceDetectionEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<FaceDetectionEffectDefinition> for ::windows::core::IInspectable { fn from(value: FaceDetectionEffectDefinition) -> Self { value.0 } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<&FaceDetectionEffectDefinition> for ::windows::core::IInspectable { fn from(value: &FaceDetectionEffectDefinition) -> Self { value.0.clone() } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for FaceDetectionEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a FaceDetectionEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<FaceDetectionEffectDefinition> for super::Effects::IVideoEffectDefinition { fn from(value: FaceDetectionEffectDefinition) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<&FaceDetectionEffectDefinition> for super::Effects::IVideoEffectDefinition { fn from(value: &FaceDetectionEffectDefinition) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, super::Effects::IVideoEffectDefinition> for FaceDetectionEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, super::Effects::IVideoEffectDefinition> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, super::Effects::IVideoEffectDefinition> for &FaceDetectionEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, super::Effects::IVideoEffectDefinition> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Media_Effects")] unsafe impl ::core::marker::Send for FaceDetectionEffectDefinition {} #[cfg(feature = "Media_Effects")] unsafe impl ::core::marker::Sync for FaceDetectionEffectDefinition {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct FaceDetectionEffectFrame(pub ::windows::core::IInspectable); impl FaceDetectionEffectFrame { #[cfg(all(feature = "Foundation_Collections", feature = "Media_FaceAnalysis"))] pub fn DetectedFaces(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<super::FaceAnalysis::DetectedFace>> { 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::<super::super::Foundation::Collections::IVectorView<super::FaceAnalysis::DetectedFace>>(result__) } } #[cfg(feature = "Foundation")] pub fn Close(&self) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::super::Foundation::IClosable>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this)).ok() } } pub fn Type(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(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 IsReadOnly(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } #[cfg(feature = "Foundation")] pub fn SetRelativeTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<super::super::Foundation::TimeSpan>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn RelativeTime(&self) -> ::windows::core::Result<super::super::Foundation::IReference<super::super::Foundation::TimeSpan>> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(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::Foundation::IReference<super::super::Foundation::TimeSpan>>(result__) } } #[cfg(feature = "Foundation")] pub fn SetSystemRelativeTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<super::super::Foundation::TimeSpan>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn SystemRelativeTime(&self) -> ::windows::core::Result<super::super::Foundation::IReference<super::super::Foundation::TimeSpan>> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(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::Foundation::IReference<super::super::Foundation::TimeSpan>>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDuration<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<super::super::Foundation::TimeSpan>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Duration(&self) -> ::windows::core::Result<super::super::Foundation::IReference<super::super::Foundation::TimeSpan>> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(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::Foundation::IReference<super::super::Foundation::TimeSpan>>(result__) } } pub fn SetIsDiscontinuous(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), value).ok() } } pub fn IsDiscontinuous(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ExtendedProperties(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IPropertySet> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IPropertySet>(result__) } } } unsafe impl ::windows::core::RuntimeType for FaceDetectionEffectFrame { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.FaceDetectionEffectFrame;{8ab08993-5dc8-447b-a247-5270bd802ece})"); } unsafe impl ::windows::core::Interface for FaceDetectionEffectFrame { type Vtable = IFaceDetectionEffectFrame_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8ab08993_5dc8_447b_a247_5270bd802ece); } impl ::windows::core::RuntimeName for FaceDetectionEffectFrame { const NAME: &'static str = "Windows.Media.Core.FaceDetectionEffectFrame"; } impl ::core::convert::From<FaceDetectionEffectFrame> for ::windows::core::IUnknown { fn from(value: FaceDetectionEffectFrame) -> Self { value.0 .0 } } impl ::core::convert::From<&FaceDetectionEffectFrame> for ::windows::core::IUnknown { fn from(value: &FaceDetectionEffectFrame) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for FaceDetectionEffectFrame { 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 FaceDetectionEffectFrame { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<FaceDetectionEffectFrame> for ::windows::core::IInspectable { fn from(value: FaceDetectionEffectFrame) -> Self { value.0 } } impl ::core::convert::From<&FaceDetectionEffectFrame> for ::windows::core::IInspectable { fn from(value: &FaceDetectionEffectFrame) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for FaceDetectionEffectFrame { 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 FaceDetectionEffectFrame { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<FaceDetectionEffectFrame> for super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: FaceDetectionEffectFrame) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<&FaceDetectionEffectFrame> for super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: &FaceDetectionEffectFrame) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::IClosable> for FaceDetectionEffectFrame { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::IClosable> { ::windows::core::IntoParam::into_param(&self) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::IClosable> for &FaceDetectionEffectFrame { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::IClosable> { ::core::convert::TryInto::<super::super::Foundation::IClosable>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } impl ::core::convert::TryFrom<FaceDetectionEffectFrame> for super::IMediaFrame { type Error = ::windows::core::Error; fn try_from(value: FaceDetectionEffectFrame) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&FaceDetectionEffectFrame> for super::IMediaFrame { type Error = ::windows::core::Error; fn try_from(value: &FaceDetectionEffectFrame) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, super::IMediaFrame> for FaceDetectionEffectFrame { fn into_param(self) -> ::windows::core::Param<'a, super::IMediaFrame> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, super::IMediaFrame> for &FaceDetectionEffectFrame { fn into_param(self) -> ::windows::core::Param<'a, super::IMediaFrame> { ::core::convert::TryInto::<super::IMediaFrame>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for FaceDetectionEffectFrame {} unsafe impl ::core::marker::Sync for FaceDetectionEffectFrame {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct FaceDetectionMode(pub i32); impl FaceDetectionMode { pub const HighPerformance: FaceDetectionMode = FaceDetectionMode(0i32); pub const Balanced: FaceDetectionMode = FaceDetectionMode(1i32); pub const HighQuality: FaceDetectionMode = FaceDetectionMode(2i32); } impl ::core::convert::From<i32> for FaceDetectionMode { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for FaceDetectionMode { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for FaceDetectionMode { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.FaceDetectionMode;i4)"); } impl ::windows::core::DefaultType for FaceDetectionMode { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct HighDynamicRangeControl(pub ::windows::core::IInspectable); impl HighDynamicRangeControl { pub fn SetEnabled(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value).ok() } } pub fn Enabled(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } } unsafe impl ::windows::core::RuntimeType for HighDynamicRangeControl { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.HighDynamicRangeControl;{55f1a7ae-d957-4dc9-9d1c-8553a82a7d99})"); } unsafe impl ::windows::core::Interface for HighDynamicRangeControl { type Vtable = IHighDynamicRangeControl_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x55f1a7ae_d957_4dc9_9d1c_8553a82a7d99); } impl ::windows::core::RuntimeName for HighDynamicRangeControl { const NAME: &'static str = "Windows.Media.Core.HighDynamicRangeControl"; } impl ::core::convert::From<HighDynamicRangeControl> for ::windows::core::IUnknown { fn from(value: HighDynamicRangeControl) -> Self { value.0 .0 } } impl ::core::convert::From<&HighDynamicRangeControl> for ::windows::core::IUnknown { fn from(value: &HighDynamicRangeControl) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for HighDynamicRangeControl { 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 HighDynamicRangeControl { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<HighDynamicRangeControl> for ::windows::core::IInspectable { fn from(value: HighDynamicRangeControl) -> Self { value.0 } } impl ::core::convert::From<&HighDynamicRangeControl> for ::windows::core::IInspectable { fn from(value: &HighDynamicRangeControl) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for HighDynamicRangeControl { 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 HighDynamicRangeControl { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for HighDynamicRangeControl {} unsafe impl ::core::marker::Sync for HighDynamicRangeControl {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct HighDynamicRangeOutput(pub ::windows::core::IInspectable); impl HighDynamicRangeOutput { pub fn Certainty(&self) -> ::windows::core::Result<f64> { let this = self; unsafe { let mut result__: f64 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<f64>(result__) } } #[cfg(all(feature = "Foundation_Collections", feature = "Media_Devices_Core"))] pub fn FrameControllers(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<super::Devices::Core::FrameController>> { 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::Foundation::Collections::IVectorView<super::Devices::Core::FrameController>>(result__) } } } unsafe impl ::windows::core::RuntimeType for HighDynamicRangeOutput { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.HighDynamicRangeOutput;{0f57806b-253b-4119-bb40-3a90e51384f7})"); } unsafe impl ::windows::core::Interface for HighDynamicRangeOutput { type Vtable = IHighDynamicRangeOutput_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0f57806b_253b_4119_bb40_3a90e51384f7); } impl ::windows::core::RuntimeName for HighDynamicRangeOutput { const NAME: &'static str = "Windows.Media.Core.HighDynamicRangeOutput"; } impl ::core::convert::From<HighDynamicRangeOutput> for ::windows::core::IUnknown { fn from(value: HighDynamicRangeOutput) -> Self { value.0 .0 } } impl ::core::convert::From<&HighDynamicRangeOutput> for ::windows::core::IUnknown { fn from(value: &HighDynamicRangeOutput) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for HighDynamicRangeOutput { 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 HighDynamicRangeOutput { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<HighDynamicRangeOutput> for ::windows::core::IInspectable { fn from(value: HighDynamicRangeOutput) -> Self { value.0 } } impl ::core::convert::From<&HighDynamicRangeOutput> for ::windows::core::IInspectable { fn from(value: &HighDynamicRangeOutput) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for HighDynamicRangeOutput { 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 HighDynamicRangeOutput { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for HighDynamicRangeOutput {} unsafe impl ::core::marker::Sync for HighDynamicRangeOutput {} #[repr(transparent)] #[doc(hidden)] pub struct IAudioStreamDescriptor(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAudioStreamDescriptor { type Vtable = IAudioStreamDescriptor_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1e3692e4_4027_4847_a70b_df1d9a2a7b04); } #[repr(C)] #[doc(hidden)] pub struct IAudioStreamDescriptor_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 = "Media_MediaProperties")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_MediaProperties"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IAudioStreamDescriptor2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAudioStreamDescriptor2 { type Vtable = IAudioStreamDescriptor2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2e68f1f6_a448_497b_8840_85082665acf9); } #[repr(C)] #[doc(hidden)] pub struct IAudioStreamDescriptor2_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, value: ::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, value: ::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 IAudioStreamDescriptor3(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAudioStreamDescriptor3 { type Vtable = IAudioStreamDescriptor3_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4d220da1_8e83_44ef_8973_2f63e993f36b); } #[repr(C)] #[doc(hidden)] pub struct IAudioStreamDescriptor3_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 IAudioStreamDescriptorFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAudioStreamDescriptorFactory { type Vtable = IAudioStreamDescriptorFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4a86ce9e_4cb1_4380_8e0c_83504b7f5bf3); } #[repr(C)] #[doc(hidden)] pub struct IAudioStreamDescriptorFactory_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 = "Media_MediaProperties")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, encodingproperties: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_MediaProperties"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IAudioTrack(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAudioTrack { type Vtable = IAudioTrack_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf23b6e77_3ef7_40de_b943_068b1321701d); } #[repr(C)] #[doc(hidden)] pub struct IAudioTrack_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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Media_MediaProperties")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_MediaProperties"))] usize, #[cfg(feature = "Media_Playback")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_Playback"))] 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 ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IAudioTrackOpenFailedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAudioTrackOpenFailedEventArgs { type Vtable = IAudioTrackOpenFailedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xeeddb9b9_bb7c_4112_bf76_9384676f824b); } #[repr(C)] #[doc(hidden)] pub struct IAudioTrackOpenFailedEventArgs_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::HRESULT) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IAudioTrackSupportInfo(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IAudioTrackSupportInfo { type Vtable = IAudioTrackSupportInfo_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x178beff7_cc39_44a6_b951_4a5653f073fa); } #[repr(C)] #[doc(hidden)] pub struct IAudioTrackSupportInfo_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 MediaDecoderStatus) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut AudioDecoderDegradation) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut AudioDecoderDegradationReason) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut MediaSourceStatus) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IChapterCue(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IChapterCue { type Vtable = IChapterCue_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x72a98001_d38a_4c0a_8fa6_75cddaf4664c); } #[repr(C)] #[doc(hidden)] pub struct IChapterCue_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, value: ::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, ); #[repr(transparent)] #[doc(hidden)] pub struct ICodecInfo(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ICodecInfo { type Vtable = ICodecInfo_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x51e89f85_ea97_499c_86ac_4ce5e73f3a42); } #[repr(C)] #[doc(hidden)] pub struct ICodecInfo_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 CodecKind) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut CodecCategory) -> ::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 bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ICodecQuery(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ICodecQuery { type Vtable = ICodecQuery_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x222a953a_af61_4e04_808a_a4634e2f3ac4); } #[repr(C)] #[doc(hidden)] pub struct ICodecQuery_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(all(feature = "Foundation", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, kind: CodecKind, category: CodecCategory, subtype: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Foundation_Collections")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ICodecSubtypesStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ICodecSubtypesStatics { type Vtable = ICodecSubtypesStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa66ac4f2_888b_4224_8cf6_2a8d4eb02382); } #[repr(C)] #[doc(hidden)] pub struct ICodecSubtypesStatics_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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, ); #[repr(transparent)] #[doc(hidden)] pub struct IDataCue(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IDataCue { type Vtable = IDataCue_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7c7f676d_1fbc_4e2d_9a87_ee38bd1dc637); } #[repr(C)] #[doc(hidden)] pub struct IDataCue_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 = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, #[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IDataCue2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IDataCue2 { type Vtable = IDataCue2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbc561b15_95f2_49e8_96f1_8dd5dac68d93); } #[repr(C)] #[doc(hidden)] pub struct IDataCue2_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_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IFaceDetectedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IFaceDetectedEventArgs { type Vtable = IFaceDetectedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x19918426_c65b_46ba_85f8_13880576c90a); } #[repr(C)] #[doc(hidden)] pub struct IFaceDetectedEventArgs_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 IFaceDetectionEffect(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IFaceDetectionEffect { type Vtable = IFaceDetectionEffect_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xae15ebd2_0542_42a9_bc90_f283a29f46c1); } #[repr(C)] #[doc(hidden)] pub struct IFaceDetectionEffect_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, value: bool) -> ::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, value: super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, cookie: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IFaceDetectionEffectDefinition(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IFaceDetectionEffectDefinition { type Vtable = IFaceDetectionEffectDefinition_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x43dca081_b848_4f33_b702_1fd2624fb016); } #[repr(C)] #[doc(hidden)] pub struct IFaceDetectionEffectDefinition_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, value: FaceDetectionMode) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut FaceDetectionMode) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IFaceDetectionEffectFrame(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IFaceDetectionEffectFrame { type Vtable = IFaceDetectionEffectFrame_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8ab08993_5dc8_447b_a247_5270bd802ece); } #[repr(C)] #[doc(hidden)] pub struct IFaceDetectionEffectFrame_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(all(feature = "Foundation_Collections", feature = "Media_FaceAnalysis"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation_Collections", feature = "Media_FaceAnalysis")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IHighDynamicRangeControl(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IHighDynamicRangeControl { type Vtable = IHighDynamicRangeControl_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x55f1a7ae_d957_4dc9_9d1c_8553a82a7d99); } #[repr(C)] #[doc(hidden)] pub struct IHighDynamicRangeControl_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, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IHighDynamicRangeOutput(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IHighDynamicRangeOutput { type Vtable = IHighDynamicRangeOutput_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0f57806b_253b_4119_bb40_3a90e51384f7); } #[repr(C)] #[doc(hidden)] pub struct IHighDynamicRangeOutput_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 f64) -> ::windows::core::HRESULT, #[cfg(all(feature = "Foundation_Collections", feature = "Media_Devices_Core"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation_Collections", feature = "Media_Devices_Core")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IImageCue(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IImageCue { type Vtable = IImageCue_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x52828282_367b_440b_9116_3c84570dd270); } #[repr(C)] #[doc(hidden)] pub struct IImageCue_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 TimedTextPoint) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextPoint) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextSize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextSize) -> ::windows::core::HRESULT, #[cfg(feature = "Graphics_Imaging")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Graphics_Imaging"))] usize, #[cfg(feature = "Graphics_Imaging")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Graphics_Imaging"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IInitializeMediaStreamSourceRequestedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IInitializeMediaStreamSourceRequestedEventArgs { type Vtable = IInitializeMediaStreamSourceRequestedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x25bc45e1_9b08_4c2e_a855_4542f1a75deb); } #[repr(C)] #[doc(hidden)] pub struct IInitializeMediaStreamSourceRequestedEventArgs_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 = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] 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 ILowLightFusionResult(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ILowLightFusionResult { type Vtable = ILowLightFusionResult_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x78edbe35_27a0_42e0_9cd3_738d2089de9c); } #[repr(C)] #[doc(hidden)] pub struct ILowLightFusionResult_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 = "Graphics_Imaging")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Graphics_Imaging"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ILowLightFusionStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ILowLightFusionStatics { type Vtable = ILowLightFusionStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5305016d_c29e_40e2_87a9_9e1fd2f192f5); } #[repr(C)] #[doc(hidden)] pub struct ILowLightFusionStatics_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(all(feature = "Foundation_Collections", feature = "Graphics_Imaging"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation_Collections", feature = "Graphics_Imaging")))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut i32) -> ::windows::core::HRESULT, #[cfg(all(feature = "Foundation", feature = "Foundation_Collections", feature = "Graphics_Imaging"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, frameset: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Foundation_Collections", feature = "Graphics_Imaging")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaBinder(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaBinder { type Vtable = IMediaBinder_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2b7e40aa_de07_424f_83f1_f1de46c4fa2e); } #[repr(C)] #[doc(hidden)] pub struct IMediaBinder_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::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::Foundation::EventRegistrationToken) -> ::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, value: ::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, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaBindingEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaBindingEventArgs { type Vtable = IMediaBindingEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb61cb25a_1b6d_4630_a86d_2f0837f712e5); } #[repr(C)] #[doc(hidden)] pub struct IMediaBindingEventArgs_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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, 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, uri: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stream: ::windows::core::RawPtr, contenttype: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, #[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stream: ::windows::core::RawPtr, contenttype: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaBindingEventArgs2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaBindingEventArgs2 { type Vtable = IMediaBindingEventArgs2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0464cceb_bb5a_482f_b8ba_f0284c696567); } #[repr(C)] #[doc(hidden)] pub struct IMediaBindingEventArgs2_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 = "Media_Streaming_Adaptive")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, mediasource: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_Streaming_Adaptive"))] usize, #[cfg(feature = "Storage")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, file: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaBindingEventArgs3(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaBindingEventArgs3 { type Vtable = IMediaBindingEventArgs3_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf8eb475e_19be_44fc_a5ed_7aba315037f9); } #[repr(C)] #[doc(hidden)] pub struct IMediaBindingEventArgs3_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 = "Networking_BackgroundTransfer")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, downloadoperation: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Networking_BackgroundTransfer"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IMediaCue(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaCue { type Vtable = IMediaCue_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc7d15e5d_59dc_431f_a0ee_27744323b36d); } impl IMediaCue { #[cfg(feature = "Foundation")] pub fn SetStartTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn StartTime(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDuration<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Duration(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } pub fn SetId<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Id(&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__) } } } unsafe impl ::windows::core::RuntimeType for IMediaCue { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{c7d15e5d-59dc-431f-a0ee-27744323b36d}"); } impl ::core::convert::From<IMediaCue> for ::windows::core::IUnknown { fn from(value: IMediaCue) -> Self { value.0 .0 } } impl ::core::convert::From<&IMediaCue> for ::windows::core::IUnknown { fn from(value: &IMediaCue) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMediaCue { 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 IMediaCue { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IMediaCue> for ::windows::core::IInspectable { fn from(value: IMediaCue) -> Self { value.0 } } impl ::core::convert::From<&IMediaCue> for ::windows::core::IInspectable { fn from(value: &IMediaCue) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IMediaCue { 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 IMediaCue { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IMediaCue_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, value: super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::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, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaCueEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaCueEventArgs { type Vtable = IMediaCueEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd12f47f7_5fa4_4e68_9fe5_32160dcee57e); } #[repr(C)] #[doc(hidden)] pub struct IMediaCueEventArgs_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)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IMediaSource(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSource { type Vtable = IMediaSource_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xe7bfb599_a09d_4c21_bcdf_20af4f86b3d9); } impl IMediaSource {} unsafe impl ::windows::core::RuntimeType for IMediaSource { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{e7bfb599-a09d-4c21-bcdf-20af4f86b3d9}"); } impl ::core::convert::From<IMediaSource> for ::windows::core::IUnknown { fn from(value: IMediaSource) -> Self { value.0 .0 } } impl ::core::convert::From<&IMediaSource> for ::windows::core::IUnknown { fn from(value: &IMediaSource) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMediaSource { 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 IMediaSource { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IMediaSource> for ::windows::core::IInspectable { fn from(value: IMediaSource) -> Self { value.0 } } impl ::core::convert::From<&IMediaSource> for ::windows::core::IInspectable { fn from(value: &IMediaSource) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IMediaSource { 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 IMediaSource { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IMediaSource_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, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaSource2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSource2 { type Vtable = IMediaSource2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2eb61048_655f_4c37_b813_b4e45dfa0abe); } #[repr(C)] #[doc(hidden)] pub struct IMediaSource2_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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[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(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::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(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, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaSource3(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSource3 { type Vtable = IMediaSource3_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb59f0d9b_4b6e_41ed_bbb4_7c7509a994ad); } #[repr(C)] #[doc(hidden)] pub struct IMediaSource3_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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut MediaSourceState) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaSource4(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSource4 { type Vtable = IMediaSource4_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbdafad57_8eff_4c63_85a6_84de0ae3e4f2); } #[repr(C)] #[doc(hidden)] pub struct IMediaSource4_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 = "Media_Streaming_Adaptive")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_Streaming_Adaptive"))] usize, 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 ::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 IMediaSource5(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSource5 { type Vtable = IMediaSource5_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x331a22ae_ed2e_4a22_94c8_b743a92b3022); } #[repr(C)] #[doc(hidden)] pub struct IMediaSource5_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 = "Networking_BackgroundTransfer")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Networking_BackgroundTransfer"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaSourceAppServiceConnection(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSourceAppServiceConnection { type Vtable = IMediaSourceAppServiceConnection_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x61e1ea97_1916_4810_b7f4_b642be829596); } #[repr(C)] #[doc(hidden)] pub struct IMediaSourceAppServiceConnection_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::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::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 IMediaSourceAppServiceConnectionFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSourceAppServiceConnectionFactory { type Vtable = IMediaSourceAppServiceConnectionFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x65b912eb_80b9_44f9_9c1e_e120f6d92838); } #[repr(C)] #[doc(hidden)] pub struct IMediaSourceAppServiceConnectionFactory_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 = "ApplicationModel_AppService")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, appserviceconnection: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "ApplicationModel_AppService"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaSourceError(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSourceError { type Vtable = IMediaSourceError_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5c0a8965_37c5_4e9d_8d21_1cdee90cecc6); } #[repr(C)] #[doc(hidden)] pub struct IMediaSourceError_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::HRESULT) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaSourceOpenOperationCompletedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSourceOpenOperationCompletedEventArgs { type Vtable = IMediaSourceOpenOperationCompletedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfc682ceb_e281_477c_a8e0_1acd654114c8); } #[repr(C)] #[doc(hidden)] pub struct IMediaSourceOpenOperationCompletedEventArgs_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 IMediaSourceStateChangedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSourceStateChangedEventArgs { type Vtable = IMediaSourceStateChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0a30af82_9071_4bac_bc39_ca2a93b717a9); } #[repr(C)] #[doc(hidden)] pub struct IMediaSourceStateChangedEventArgs_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 MediaSourceState) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut MediaSourceState) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaSourceStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSourceStatics { type Vtable = IMediaSourceStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf77d6fa4_4652_410e_b1d8_e9a5e245a45c); } #[repr(C)] #[doc(hidden)] pub struct IMediaSourceStatics_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 = "Media_Streaming_Adaptive")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, mediasource: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_Streaming_Adaptive"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, mediasource: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, mediasource: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, mediasource: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Storage")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, file: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage"))] usize, #[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stream: ::windows::core::RawPtr, contenttype: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, #[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stream: ::windows::core::RawPtr, contenttype: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, uri: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaSourceStatics2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSourceStatics2 { type Vtable = IMediaSourceStatics2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xeee161a4_7f13_4896_b8cb_df0de5bcb9f1); } #[repr(C)] #[doc(hidden)] pub struct IMediaSourceStatics2_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, binder: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaSourceStatics3(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSourceStatics3 { type Vtable = IMediaSourceStatics3_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x453a30d6_2bea_4122_9f73_eace04526e35); } #[repr(C)] #[doc(hidden)] pub struct IMediaSourceStatics3_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 = "Media_Capture_Frames")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, framesource: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_Capture_Frames"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaSourceStatics4(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaSourceStatics4 { type Vtable = IMediaSourceStatics4_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x281b3bfc_e50a_4428_a500_9c4ed918d3f0); } #[repr(C)] #[doc(hidden)] pub struct IMediaSourceStatics4_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 = "Networking_BackgroundTransfer")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, downloadoperation: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Networking_BackgroundTransfer"))] usize, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IMediaStreamDescriptor(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamDescriptor { type Vtable = IMediaStreamDescriptor_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x80f16e6e_92f7_451e_97d2_afd80742da70); } impl IMediaStreamDescriptor { pub fn IsSelected(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } 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__) } } pub fn SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&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__) } } } unsafe impl ::windows::core::RuntimeType for IMediaStreamDescriptor { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{80f16e6e-92f7-451e-97d2-afd80742da70}"); } impl ::core::convert::From<IMediaStreamDescriptor> for ::windows::core::IUnknown { fn from(value: IMediaStreamDescriptor) -> Self { value.0 .0 } } impl ::core::convert::From<&IMediaStreamDescriptor> for ::windows::core::IUnknown { fn from(value: &IMediaStreamDescriptor) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMediaStreamDescriptor { 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 IMediaStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IMediaStreamDescriptor> for ::windows::core::IInspectable { fn from(value: IMediaStreamDescriptor) -> Self { value.0 } } impl ::core::convert::From<&IMediaStreamDescriptor> for ::windows::core::IInspectable { fn from(value: &IMediaStreamDescriptor) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IMediaStreamDescriptor { 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 IMediaStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamDescriptor_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 bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::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, value: ::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, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IMediaStreamDescriptor2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamDescriptor2 { type Vtable = IMediaStreamDescriptor2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5073010f_e8b2_4071_b00b_ebf337a76b58); } impl IMediaStreamDescriptor2 { pub fn IsSelected(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(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 SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(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 SetLabel<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Label(&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__) } } } unsafe impl ::windows::core::RuntimeType for IMediaStreamDescriptor2 { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{5073010f-e8b2-4071-b00b-ebf337a76b58}"); } impl ::core::convert::From<IMediaStreamDescriptor2> for ::windows::core::IUnknown { fn from(value: IMediaStreamDescriptor2) -> Self { value.0 .0 } } impl ::core::convert::From<&IMediaStreamDescriptor2> for ::windows::core::IUnknown { fn from(value: &IMediaStreamDescriptor2) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMediaStreamDescriptor2 { 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 IMediaStreamDescriptor2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IMediaStreamDescriptor2> for ::windows::core::IInspectable { fn from(value: IMediaStreamDescriptor2) -> Self { value.0 } } impl ::core::convert::From<&IMediaStreamDescriptor2> for ::windows::core::IInspectable { fn from(value: &IMediaStreamDescriptor2) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IMediaStreamDescriptor2 { 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 IMediaStreamDescriptor2 { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<IMediaStreamDescriptor2> for IMediaStreamDescriptor { type Error = ::windows::core::Error; fn try_from(value: IMediaStreamDescriptor2) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&IMediaStreamDescriptor2> for IMediaStreamDescriptor { type Error = ::windows::core::Error; fn try_from(value: &IMediaStreamDescriptor2) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor> for IMediaStreamDescriptor2 { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor> for &IMediaStreamDescriptor2 { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor> { ::core::convert::TryInto::<IMediaStreamDescriptor>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamDescriptor2_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, value: ::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, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSample(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSample { type Vtable = IMediaStreamSample_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5c8db627_4b80_4361_9837_6cb7481ad9d6); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSample_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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[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 ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSample2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSample2 { type Vtable = IMediaStreamSample2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x45078691_fce8_4746_a1c8_10c25d3d7cd3); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSample2_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 = "Graphics_DirectX_Direct3D11")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Graphics_DirectX_Direct3D11"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSampleProtectionProperties(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSampleProtectionProperties { type Vtable = IMediaStreamSampleProtectionProperties_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4eb88292_ecdf_493e_841d_dd4add7caca2); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSampleProtectionProperties_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, value_array_size: u32, value: *const u8) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value_array_size: *mut u32, value: *mut *mut u8) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value_array_size: u32, value: *const u8) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value_array_size: *mut u32, value: *mut *mut u8) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value_array_size: u32, value: *const u8) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value_array_size: *mut u32, value: *mut *mut u8) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSampleStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSampleStatics { type Vtable = IMediaStreamSampleStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xdfdf218f_a6cf_4579_be41_73dd941ad972); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSampleStatics_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(all(feature = "Foundation", feature = "Storage_Streams"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, buffer: ::windows::core::RawPtr, timestamp: super::super::Foundation::TimeSpan, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Storage_Streams")))] usize, #[cfg(all(feature = "Foundation", feature = "Storage_Streams"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stream: ::windows::core::RawPtr, count: u32, timestamp: super::super::Foundation::TimeSpan, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Storage_Streams")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSampleStatics2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSampleStatics2 { type Vtable = IMediaStreamSampleStatics2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9efe9521_6d46_494c_a2f8_d662922e2dd7); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSampleStatics2_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(all(feature = "Foundation", feature = "Graphics_DirectX_Direct3D11"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, surface: ::windows::core::RawPtr, timestamp: super::super::Foundation::TimeSpan, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Foundation", feature = "Graphics_DirectX_Direct3D11")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSource(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSource { type Vtable = IMediaStreamSource_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3712d543_45eb_4138_aa62_c01e26f3843f); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSource_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::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::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::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::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::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::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::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::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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, errorstatus: MediaStreamSourceErrorStatus) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, descriptor: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Media_Protection")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_Protection"))] usize, #[cfg(feature = "Media_Protection")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_Protection"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::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, value: super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, startoffset: super::super::Foundation::TimeSpan, endoffset: super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Storage_FileProperties")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_FileProperties"))] usize, #[cfg(feature = "Storage_FileProperties")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_FileProperties"))] usize, #[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, #[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, streamdescriptor: ::windows::core::RawPtr, keyIdentifier_array_size: u32, keyidentifier: *const u8, licenseData_array_size: u32, licensedata: *const u8) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSource2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSource2 { type Vtable = IMediaStreamSource2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xec55d0ad_2e6a_4f74_adbb_b562d1533849); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSource2_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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSource3(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSource3 { type Vtable = IMediaStreamSource3_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x6a2a2746_3ddd_4ddf_a121_94045ecf9440); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSource3_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, value: ::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 IMediaStreamSource4(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSource4 { type Vtable = IMediaStreamSource4_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1d0cfcab_830d_417c_a3a9_2454fd6415c7); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSource4_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, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSourceClosedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSourceClosedEventArgs { type Vtable = IMediaStreamSourceClosedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcd8c7eb2_4816_4e24_88f0_491ef7386406); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSourceClosedEventArgs_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 IMediaStreamSourceClosedRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSourceClosedRequest { type Vtable = IMediaStreamSourceClosedRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x907c00e9_18a3_4951_887a_2c1eebd5c69e); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSourceClosedRequest_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 MediaStreamSourceClosedReason) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSourceFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSourceFactory { type Vtable = IMediaStreamSourceFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xef77e0d9_d158_4b7a_863f_203342fbfd41); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSourceFactory_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, descriptor: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, descriptor: ::windows::core::RawPtr, descriptor2: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSourceSampleRenderedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSourceSampleRenderedEventArgs { type Vtable = IMediaStreamSourceSampleRenderedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9d697b05_d4f2_4c7a_9dfe_8d6cd0b3ee84); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSourceSampleRenderedEventArgs_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, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSourceSampleRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSourceSampleRequest { type Vtable = IMediaStreamSourceSampleRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4db341a9_3501_4d9b_83f9_8f235c822532); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSourceSampleRequest_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, 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, value: ::windows::core::RawPtr) -> ::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, progress: u32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSourceSampleRequestDeferral(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSourceSampleRequestDeferral { type Vtable = IMediaStreamSourceSampleRequestDeferral_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7895cc02_f982_43c8_9d16_c62d999319be); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSourceSampleRequestDeferral_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) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSourceSampleRequestedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSourceSampleRequestedEventArgs { type Vtable = IMediaStreamSourceSampleRequestedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x10f9bb9e_71c5_492f_847f_0da1f35e81f8); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSourceSampleRequestedEventArgs_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 IMediaStreamSourceStartingEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSourceStartingEventArgs { type Vtable = IMediaStreamSourceStartingEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf41468f2_c274_4940_a5bb_28a572452fa7); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSourceStartingEventArgs_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 IMediaStreamSourceStartingRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSourceStartingRequest { type Vtable = IMediaStreamSourceStartingRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2a9093e4_35c4_4b1b_a791_0d99db56dd1d); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSourceStartingRequest_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, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, 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, position: super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSourceStartingRequestDeferral(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSourceStartingRequestDeferral { type Vtable = IMediaStreamSourceStartingRequestDeferral_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3f1356a5_6340_4dc4_9910_068ed9f598f8); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSourceStartingRequestDeferral_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) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSourceSwitchStreamsRequest(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSourceSwitchStreamsRequest { type Vtable = IMediaStreamSourceSwitchStreamsRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x41b8808e_38a9_4ec3_9ba0_b69b85501e90); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSourceSwitchStreamsRequest_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, 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 ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSourceSwitchStreamsRequestDeferral(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSourceSwitchStreamsRequestDeferral { type Vtable = IMediaStreamSourceSwitchStreamsRequestDeferral_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbee3d835_a505_4f9a_b943_2b8cb1b4bbd9); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSourceSwitchStreamsRequestDeferral_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) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMediaStreamSourceSwitchStreamsRequestedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaStreamSourceSwitchStreamsRequestedEventArgs { type Vtable = IMediaStreamSourceSwitchStreamsRequestedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x42202b72_6ea1_4677_981e_350a0da412aa); } #[repr(C)] #[doc(hidden)] pub struct IMediaStreamSourceSwitchStreamsRequestedEventArgs_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)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IMediaTrack(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMediaTrack { type Vtable = IMediaTrack_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x03e1fafc_c931_491a_b46b_c10ee8c256b7); } impl IMediaTrack { pub fn Id(&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 Language(&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 TrackKind(&self) -> ::windows::core::Result<MediaTrackKind> { let this = self; unsafe { let mut result__: MediaTrackKind = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MediaTrackKind>(result__) } } pub fn SetLabel<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Label(&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__) } } } unsafe impl ::windows::core::RuntimeType for IMediaTrack { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{03e1fafc-c931-491a-b46b-c10ee8c256b7}"); } impl ::core::convert::From<IMediaTrack> for ::windows::core::IUnknown { fn from(value: IMediaTrack) -> Self { value.0 .0 } } impl ::core::convert::From<&IMediaTrack> for ::windows::core::IUnknown { fn from(value: &IMediaTrack) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for IMediaTrack { 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 IMediaTrack { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<IMediaTrack> for ::windows::core::IInspectable { fn from(value: IMediaTrack) -> Self { value.0 } } impl ::core::convert::From<&IMediaTrack> for ::windows::core::IInspectable { fn from(value: &IMediaTrack) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for IMediaTrack { 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 IMediaTrack { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct IMediaTrack_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 MediaTrackKind) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::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, ); #[repr(transparent)] #[doc(hidden)] pub struct IMseSourceBuffer(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMseSourceBuffer { type Vtable = IMseSourceBuffer_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0c1aa3e3_df8d_4079_a3fe_6849184b4e2f); } #[repr(C)] #[doc(hidden)] pub struct IMseSourceBuffer_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::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::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::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::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::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::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::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::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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut MseAppendMode) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: MseAppendMode) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub unsafe extern "system" fn(this: ::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 super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::Foundation::TimeSpan) -> ::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, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, buffer: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, #[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stream: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, #[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stream: ::windows::core::RawPtr, maxsize: u64) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, start: super::super::Foundation::TimeSpan, end: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMseSourceBufferList(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMseSourceBufferList { type Vtable = IMseSourceBufferList_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x95fae8e7_a8e7_4ebf_8927_145e940ba511); } #[repr(C)] #[doc(hidden)] pub struct IMseSourceBufferList_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::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::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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[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, ); #[repr(transparent)] #[doc(hidden)] pub struct IMseStreamSource(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMseStreamSource { type Vtable = IMseStreamSource_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb0b4198d_02f4_4923_88dd_81bc3f360ffa); } #[repr(C)] #[doc(hidden)] pub struct IMseStreamSource_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::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::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::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::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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, 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 ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut MseReadyState) -> ::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, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, mimetype: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, buffer: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, status: MseEndOfStreamStatus) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IMseStreamSource2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMseStreamSource2 { type Vtable = IMseStreamSource2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x66f57d37_f9e7_418a_9cde_a020e956552b); } #[repr(C)] #[doc(hidden)] pub struct IMseStreamSource2_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, 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, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IMseStreamSourceStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IMseStreamSourceStatics { type Vtable = IMseStreamSourceStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x465c679d_d570_43ce_ba21_0bff5f3fbd0a); } #[repr(C)] #[doc(hidden)] pub struct IMseStreamSourceStatics_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, contenttype: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISceneAnalysisEffect(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISceneAnalysisEffect { type Vtable = ISceneAnalysisEffect_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc04ba319_ca41_4813_bffd_7b08b0ed2557); } #[repr(C)] #[doc(hidden)] pub struct ISceneAnalysisEffect_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, value: super::super::Foundation::TimeSpan) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::Foundation::TimeSpan) -> ::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, cookie: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ISceneAnalysisEffectFrame(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISceneAnalysisEffectFrame { type Vtable = ISceneAnalysisEffectFrame_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd8b10e4c_7fd9_42e1_85eb_6572c297c987); } #[repr(C)] #[doc(hidden)] pub struct ISceneAnalysisEffectFrame_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 = "Media_Capture")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_Capture"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISceneAnalysisEffectFrame2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISceneAnalysisEffectFrame2 { type Vtable = ISceneAnalysisEffectFrame2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2d4e29be_061f_47ae_9915_02524b5f9a5f); } #[repr(C)] #[doc(hidden)] pub struct ISceneAnalysisEffectFrame2_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 SceneAnalysisRecommendation) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISceneAnalyzedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISceneAnalyzedEventArgs { type Vtable = ISceneAnalyzedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x146b9588_2851_45e4_ad55_44cf8df8db4d); } #[repr(C)] #[doc(hidden)] pub struct ISceneAnalyzedEventArgs_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)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ISingleSelectMediaTrackList(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISingleSelectMediaTrackList { type Vtable = ISingleSelectMediaTrackList_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x77206f1f_c34f_494f_8077_2bad9ff4ecf1); } impl ISingleSelectMediaTrackList { #[cfg(feature = "Foundation")] pub fn SelectedIndexChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<ISingleSelectMediaTrackList, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveSelectedIndexChanged<'a, Param0: ::windows::core::IntoParam<'a, 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() } } pub fn SetSelectedIndex(&self, value: i32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value).ok() } } pub fn SelectedIndex(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } } unsafe impl ::windows::core::RuntimeType for ISingleSelectMediaTrackList { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{77206f1f-c34f-494f-8077-2bad9ff4ecf1}"); } impl ::core::convert::From<ISingleSelectMediaTrackList> for ::windows::core::IUnknown { fn from(value: ISingleSelectMediaTrackList) -> Self { value.0 .0 } } impl ::core::convert::From<&ISingleSelectMediaTrackList> for ::windows::core::IUnknown { fn from(value: &ISingleSelectMediaTrackList) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ISingleSelectMediaTrackList { 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 ISingleSelectMediaTrackList { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ISingleSelectMediaTrackList> for ::windows::core::IInspectable { fn from(value: ISingleSelectMediaTrackList) -> Self { value.0 } } impl ::core::convert::From<&ISingleSelectMediaTrackList> for ::windows::core::IInspectable { fn from(value: &ISingleSelectMediaTrackList) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ISingleSelectMediaTrackList { 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 ISingleSelectMediaTrackList { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct ISingleSelectMediaTrackList_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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut i32) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ISpeechCue(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ISpeechCue { type Vtable = ISpeechCue_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xaee254dc_1725_4bad_8043_a98499b017a2); } #[repr(C)] #[doc(hidden)] pub struct ISpeechCue_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, value: ::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, value: ::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, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedMetadataStreamDescriptor(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedMetadataStreamDescriptor { type Vtable = ITimedMetadataStreamDescriptor_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x133336bf_296a_463e_9ff9_01cd25691408); } #[repr(C)] #[doc(hidden)] pub struct ITimedMetadataStreamDescriptor_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 = "Media_MediaProperties")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_MediaProperties"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedMetadataStreamDescriptorFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedMetadataStreamDescriptorFactory { type Vtable = ITimedMetadataStreamDescriptorFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc027de30_7362_4ff9_98b1_2dfd0b8d1cae); } #[repr(C)] #[doc(hidden)] pub struct ITimedMetadataStreamDescriptorFactory_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 = "Media_MediaProperties")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, encodingproperties: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_MediaProperties"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedMetadataTrack(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedMetadataTrack { type Vtable = ITimedMetadataTrack_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9e6aed9e_f67a_49a9_b330_cf03b0e9cf07); } #[repr(C)] #[doc(hidden)] pub struct ITimedMetadataTrack_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::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::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::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::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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[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(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 TimedMetadataKind) -> ::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, cue: ::windows::core::RawPtr) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, cue: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedMetadataTrack2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedMetadataTrack2 { type Vtable = ITimedMetadataTrack2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x21b4b648_9f9d_40ba_a8f3_1a92753aef0b); } #[repr(C)] #[doc(hidden)] pub struct ITimedMetadataTrack2_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 = "Media_Playback")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_Playback"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedMetadataTrackError(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedMetadataTrackError { type Vtable = ITimedMetadataTrackError_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb3767915_4114_4819_b9d9_dd76089e72f8); } #[repr(C)] #[doc(hidden)] pub struct ITimedMetadataTrackError_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 TimedMetadataTrackErrorCode) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::HRESULT) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedMetadataTrackFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedMetadataTrackFactory { type Vtable = ITimedMetadataTrackFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8dd57611_97b3_4e1f_852c_0f482c81ad26); } #[repr(C)] #[doc(hidden)] pub struct ITimedMetadataTrackFactory_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, id: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, language: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, kind: TimedMetadataKind, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedMetadataTrackFailedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedMetadataTrackFailedEventArgs { type Vtable = ITimedMetadataTrackFailedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa57fc9d1_6789_4d4d_b07f_84b4f31acb70); } #[repr(C)] #[doc(hidden)] pub struct ITimedMetadataTrackFailedEventArgs_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)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ITimedMetadataTrackProvider(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedMetadataTrackProvider { type Vtable = ITimedMetadataTrackProvider_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3b7f2024_f74e_4ade_93c5_219da05b6856); } impl ITimedMetadataTrackProvider { #[cfg(feature = "Foundation_Collections")] pub fn TimedMetadataTracks(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<TimedMetadataTrack>> { 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::<super::super::Foundation::Collections::IVectorView<TimedMetadataTrack>>(result__) } } } unsafe impl ::windows::core::RuntimeType for ITimedMetadataTrackProvider { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"{3b7f2024-f74e-4ade-93c5-219da05b6856}"); } impl ::core::convert::From<ITimedMetadataTrackProvider> for ::windows::core::IUnknown { fn from(value: ITimedMetadataTrackProvider) -> Self { value.0 .0 } } impl ::core::convert::From<&ITimedMetadataTrackProvider> for ::windows::core::IUnknown { fn from(value: &ITimedMetadataTrackProvider) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ITimedMetadataTrackProvider { 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 ITimedMetadataTrackProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ITimedMetadataTrackProvider> for ::windows::core::IInspectable { fn from(value: ITimedMetadataTrackProvider) -> Self { value.0 } } impl ::core::convert::From<&ITimedMetadataTrackProvider> for ::windows::core::IInspectable { fn from(value: &ITimedMetadataTrackProvider) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ITimedMetadataTrackProvider { 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 ITimedMetadataTrackProvider { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(C)] #[doc(hidden)] pub struct ITimedMetadataTrackProvider_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_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedTextBouten(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedTextBouten { type Vtable = ITimedTextBouten_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd9062783_5597_5092_820c_8f738e0f774a); } #[repr(C)] #[doc(hidden)] pub struct ITimedTextBouten_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 TimedTextBoutenType) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextBoutenType) -> ::windows::core::HRESULT, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextBoutenPosition) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextBoutenPosition) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedTextCue(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedTextCue { type Vtable = ITimedTextCue_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x51c79e51_3b86_494d_b359_bb2ea7aca9a9); } #[repr(C)] #[doc(hidden)] pub struct ITimedTextCue_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, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: ::windows::core::RawPtr) -> ::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, value: ::windows::core::RawPtr) -> ::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, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedTextLine(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedTextLine { type Vtable = ITimedTextLine_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x978d7ce2_7308_4c66_be50_65777289f5df); } #[repr(C)] #[doc(hidden)] pub struct ITimedTextLine_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, value: ::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, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedTextRegion(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedTextRegion { type Vtable = ITimedTextRegion_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1ed0881f_8a06_4222_9f59_b21bf40124b4); } #[repr(C)] #[doc(hidden)] pub struct ITimedTextRegion_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, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextPoint) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextPoint) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextSize) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextSize) -> ::windows::core::HRESULT, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextWritingMode) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextWritingMode) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextDisplayAlignment) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextDisplayAlignment) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextDouble) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextDouble) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextPadding) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextPadding) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextWrapping) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextWrapping) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextScrollMode) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextScrollMode) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedTextRuby(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedTextRuby { type Vtable = ITimedTextRuby_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x10335c29_5b3c_5693_9959_d05a0bd24628); } #[repr(C)] #[doc(hidden)] pub struct ITimedTextRuby_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, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextRubyPosition) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextRubyPosition) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextRubyAlign) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextRubyAlign) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextRubyReserve) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextRubyReserve) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedTextSource(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedTextSource { type Vtable = ITimedTextSource_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc4ed9ba6_101f_404d_a949_82f33fcd93b7); } #[repr(C)] #[doc(hidden)] pub struct ITimedTextSource_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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedTextSourceResolveResultEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedTextSourceResolveResultEventArgs { type Vtable = ITimedTextSourceResolveResultEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x48907c9c_dcd8_4c33_9ad3_6cdce7b1c566); } #[repr(C)] #[doc(hidden)] pub struct ITimedTextSourceResolveResultEventArgs_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_Collections")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation_Collections"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedTextSourceStatics(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedTextSourceStatics { type Vtable = ITimedTextSourceStatics_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7e311853_9aba_4ac4_bb98_2fb176c3bfdd); } #[repr(C)] #[doc(hidden)] pub struct ITimedTextSourceStatics_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 = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stream: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, uri: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stream: ::windows::core::RawPtr, defaultlanguage: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, uri: ::windows::core::RawPtr, defaultlanguage: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedTextSourceStatics2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedTextSourceStatics2 { type Vtable = ITimedTextSourceStatics2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb66b7602_923e_43fa_9633_587075812db5); } #[repr(C)] #[doc(hidden)] pub struct ITimedTextSourceStatics2_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 = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stream: ::windows::core::RawPtr, indexstream: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, uri: ::windows::core::RawPtr, indexuri: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Storage_Streams")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, stream: ::windows::core::RawPtr, indexstream: ::windows::core::RawPtr, defaultlanguage: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Storage_Streams"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, uri: ::windows::core::RawPtr, indexuri: ::windows::core::RawPtr, defaultlanguage: ::core::mem::ManuallyDrop<::windows::core::HSTRING>, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedTextStyle(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedTextStyle { type Vtable = ITimedTextStyle_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1bb2384d_a825_40c2_a7f5_281eaedf3b55); } #[repr(C)] #[doc(hidden)] pub struct ITimedTextStyle_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, value: ::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, value: ::core::mem::ManuallyDrop<::windows::core::HSTRING>) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextDouble) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextDouble) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextWeight) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextWeight) -> ::windows::core::HRESULT, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextFlowDirection) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextFlowDirection) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextLineAlignment) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextLineAlignment) -> ::windows::core::HRESULT, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, #[cfg(feature = "UI")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: super::super::UI::Color) -> ::windows::core::HRESULT, #[cfg(not(feature = "UI"))] usize, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextDouble) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextDouble) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut TimedTextDouble) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextDouble) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedTextStyle2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedTextStyle2 { type Vtable = ITimedTextStyle2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x655f492d_6111_4787_89cc_686fece57e14); } #[repr(C)] #[doc(hidden)] pub struct ITimedTextStyle2_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 TimedTextFontStyle) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: TimedTextFontStyle) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedTextStyle3(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedTextStyle3 { type Vtable = ITimedTextStyle3_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf803f93b_3e99_595e_bbb7_78a2fa13c270); } #[repr(C)] #[doc(hidden)] pub struct ITimedTextStyle3_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, 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 bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: bool) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut f64) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: f64) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct ITimedTextSubformat(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for ITimedTextSubformat { type Vtable = ITimedTextSubformat_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd713502f_3261_4722_a0c2_b937b2390f14); } #[repr(C)] #[doc(hidden)] pub struct ITimedTextSubformat_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 i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut i32) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, value: i32) -> ::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, value: ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IVideoStabilizationEffect(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IVideoStabilizationEffect { type Vtable = IVideoStabilizationEffect_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0808a650_9698_4e57_877b_bd7cb2ee0f8a); } #[repr(C)] #[doc(hidden)] pub struct IVideoStabilizationEffect_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, value: bool) -> ::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, handler: ::windows::core::RawPtr, result__: *mut super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Foundation")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, cookie: super::super::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(all(feature = "Media_Capture", feature = "Media_Devices", feature = "Media_MediaProperties"))] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, controller: ::windows::core::RawPtr, desiredproperties: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(all(feature = "Media_Capture", feature = "Media_Devices", feature = "Media_MediaProperties")))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IVideoStabilizationEffectEnabledChangedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IVideoStabilizationEffectEnabledChangedEventArgs { type Vtable = IVideoStabilizationEffectEnabledChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x187eff28_67bb_4713_b900_4168da164529); } #[repr(C)] #[doc(hidden)] pub struct IVideoStabilizationEffectEnabledChangedEventArgs_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 VideoStabilizationEffectEnabledChangedReason) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IVideoStreamDescriptor(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IVideoStreamDescriptor { type Vtable = IVideoStreamDescriptor_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x12ee0d55_9c2b_4440_8057_2c7a90f0cbec); } #[repr(C)] #[doc(hidden)] pub struct IVideoStreamDescriptor_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 = "Media_MediaProperties")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_MediaProperties"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IVideoStreamDescriptor2(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IVideoStreamDescriptor2 { type Vtable = IVideoStreamDescriptor2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x8b306e10_453e_4088_832d_c36fa4f94af3); } #[repr(C)] #[doc(hidden)] pub struct IVideoStreamDescriptor2_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 IVideoStreamDescriptorFactory(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IVideoStreamDescriptorFactory { type Vtable = IVideoStreamDescriptorFactory_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x494ef6d1_bb75_43d2_9e5e_7b79a3afced4); } #[repr(C)] #[doc(hidden)] pub struct IVideoStreamDescriptorFactory_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 = "Media_MediaProperties")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, encodingproperties: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_MediaProperties"))] usize, ); #[repr(transparent)] #[doc(hidden)] pub struct IVideoTrack(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IVideoTrack { type Vtable = IVideoTrack_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x99f3b7f3_e298_4396_bb6a_a51be6a2a20a); } #[repr(C)] #[doc(hidden)] pub struct IVideoTrack_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::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::Foundation::EventRegistrationToken) -> ::windows::core::HRESULT, #[cfg(not(feature = "Foundation"))] usize, #[cfg(feature = "Media_MediaProperties")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_MediaProperties"))] usize, #[cfg(feature = "Media_Playback")] pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT, #[cfg(not(feature = "Media_Playback"))] 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 ::windows::core::RawPtr) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IVideoTrackOpenFailedEventArgs(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IVideoTrackOpenFailedEventArgs { type Vtable = IVideoTrackOpenFailedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7679e231_04f9_4c82_a4ee_8602c8bb4754); } #[repr(C)] #[doc(hidden)] pub struct IVideoTrackOpenFailedEventArgs_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::HRESULT) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[doc(hidden)] pub struct IVideoTrackSupportInfo(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IVideoTrackSupportInfo { type Vtable = IVideoTrackSupportInfo_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4bb534a0_fc5f_450d_8ff0_778d590486de); } #[repr(C)] #[doc(hidden)] pub struct IVideoTrackSupportInfo_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 MediaDecoderStatus) -> ::windows::core::HRESULT, pub unsafe extern "system" fn(this: ::windows::core::RawPtr, result__: *mut MediaSourceStatus) -> ::windows::core::HRESULT, ); #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct ImageCue(pub ::windows::core::IInspectable); impl ImageCue { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<ImageCue, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation")] pub fn SetStartTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn StartTime(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDuration<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Duration(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } pub fn SetId<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Id(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaCue>(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 Position(&self) -> ::windows::core::Result<TimedTextPoint> { let this = self; unsafe { let mut result__: TimedTextPoint = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextPoint>(result__) } } pub fn SetPosition<'a, Param0: ::windows::core::IntoParam<'a, TimedTextPoint>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Extent(&self) -> ::windows::core::Result<TimedTextSize> { let this = self; unsafe { let mut result__: TimedTextSize = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextSize>(result__) } } pub fn SetExtent<'a, Param0: ::windows::core::IntoParam<'a, TimedTextSize>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Graphics_Imaging")] pub fn SetSoftwareBitmap<'a, Param0: ::windows::core::IntoParam<'a, super::super::Graphics::Imaging::SoftwareBitmap>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Graphics_Imaging")] pub fn SoftwareBitmap(&self) -> ::windows::core::Result<super::super::Graphics::Imaging::SoftwareBitmap> { 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::Graphics::Imaging::SoftwareBitmap>(result__) } } } unsafe impl ::windows::core::RuntimeType for ImageCue { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.ImageCue;{52828282-367b-440b-9116-3c84570dd270})"); } unsafe impl ::windows::core::Interface for ImageCue { type Vtable = IImageCue_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x52828282_367b_440b_9116_3c84570dd270); } impl ::windows::core::RuntimeName for ImageCue { const NAME: &'static str = "Windows.Media.Core.ImageCue"; } impl ::core::convert::From<ImageCue> for ::windows::core::IUnknown { fn from(value: ImageCue) -> Self { value.0 .0 } } impl ::core::convert::From<&ImageCue> for ::windows::core::IUnknown { fn from(value: &ImageCue) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for ImageCue { 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 ImageCue { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<ImageCue> for ::windows::core::IInspectable { fn from(value: ImageCue) -> Self { value.0 } } impl ::core::convert::From<&ImageCue> for ::windows::core::IInspectable { fn from(value: &ImageCue) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for ImageCue { 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 ImageCue { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<ImageCue> for IMediaCue { type Error = ::windows::core::Error; fn try_from(value: ImageCue) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&ImageCue> for IMediaCue { type Error = ::windows::core::Error; fn try_from(value: &ImageCue) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaCue> for ImageCue { fn into_param(self) -> ::windows::core::Param<'a, IMediaCue> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaCue> for &ImageCue { fn into_param(self) -> ::windows::core::Param<'a, IMediaCue> { ::core::convert::TryInto::<IMediaCue>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for ImageCue {} unsafe impl ::core::marker::Sync for ImageCue {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct InitializeMediaStreamSourceRequestedEventArgs(pub ::windows::core::IInspectable); impl InitializeMediaStreamSourceRequestedEventArgs { pub fn Source(&self) -> ::windows::core::Result<MediaStreamSource> { 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::<MediaStreamSource>(result__) } } #[cfg(feature = "Storage_Streams")] pub fn RandomAccessStream(&self) -> ::windows::core::Result<super::super::Storage::Streams::IRandomAccessStream> { 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::Storage::Streams::IRandomAccessStream>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::Foundation::Deferral> { 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::Foundation::Deferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for InitializeMediaStreamSourceRequestedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.InitializeMediaStreamSourceRequestedEventArgs;{25bc45e1-9b08-4c2e-a855-4542f1a75deb})"); } unsafe impl ::windows::core::Interface for InitializeMediaStreamSourceRequestedEventArgs { type Vtable = IInitializeMediaStreamSourceRequestedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x25bc45e1_9b08_4c2e_a855_4542f1a75deb); } impl ::windows::core::RuntimeName for InitializeMediaStreamSourceRequestedEventArgs { const NAME: &'static str = "Windows.Media.Core.InitializeMediaStreamSourceRequestedEventArgs"; } impl ::core::convert::From<InitializeMediaStreamSourceRequestedEventArgs> for ::windows::core::IUnknown { fn from(value: InitializeMediaStreamSourceRequestedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&InitializeMediaStreamSourceRequestedEventArgs> for ::windows::core::IUnknown { fn from(value: &InitializeMediaStreamSourceRequestedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for InitializeMediaStreamSourceRequestedEventArgs { 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 InitializeMediaStreamSourceRequestedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<InitializeMediaStreamSourceRequestedEventArgs> for ::windows::core::IInspectable { fn from(value: InitializeMediaStreamSourceRequestedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&InitializeMediaStreamSourceRequestedEventArgs> for ::windows::core::IInspectable { fn from(value: &InitializeMediaStreamSourceRequestedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for InitializeMediaStreamSourceRequestedEventArgs { 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 InitializeMediaStreamSourceRequestedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for InitializeMediaStreamSourceRequestedEventArgs {} unsafe impl ::core::marker::Sync for InitializeMediaStreamSourceRequestedEventArgs {} pub struct LowLightFusion {} impl LowLightFusion { #[cfg(all(feature = "Foundation_Collections", feature = "Graphics_Imaging"))] pub fn SupportedBitmapPixelFormats() -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<super::super::Graphics::Imaging::BitmapPixelFormat>> { Self::ILowLightFusionStatics(|this| 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::<super::super::Foundation::Collections::IVectorView<super::super::Graphics::Imaging::BitmapPixelFormat>>(result__) }) } pub fn MaxSupportedFrameCount() -> ::windows::core::Result<i32> { Self::ILowLightFusionStatics(|this| unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) }) } #[cfg(all(feature = "Foundation", feature = "Foundation_Collections", feature = "Graphics_Imaging"))] pub fn FuseAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IIterable<super::super::Graphics::Imaging::SoftwareBitmap>>>(frameset: Param0) -> ::windows::core::Result<super::super::Foundation::IAsyncOperationWithProgress<LowLightFusionResult, f64>> { Self::ILowLightFusionStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), frameset.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperationWithProgress<LowLightFusionResult, f64>>(result__) }) } pub fn ILowLightFusionStatics<R, F: FnOnce(&ILowLightFusionStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<LowLightFusion, ILowLightFusionStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } impl ::windows::core::RuntimeName for LowLightFusion { const NAME: &'static str = "Windows.Media.Core.LowLightFusion"; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct LowLightFusionResult(pub ::windows::core::IInspectable); impl LowLightFusionResult { #[cfg(feature = "Foundation")] pub fn Close(&self) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::super::Foundation::IClosable>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this)).ok() } } #[cfg(feature = "Graphics_Imaging")] pub fn Frame(&self) -> ::windows::core::Result<super::super::Graphics::Imaging::SoftwareBitmap> { 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::<super::super::Graphics::Imaging::SoftwareBitmap>(result__) } } } unsafe impl ::windows::core::RuntimeType for LowLightFusionResult { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.LowLightFusionResult;{78edbe35-27a0-42e0-9cd3-738d2089de9c})"); } unsafe impl ::windows::core::Interface for LowLightFusionResult { type Vtable = ILowLightFusionResult_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x78edbe35_27a0_42e0_9cd3_738d2089de9c); } impl ::windows::core::RuntimeName for LowLightFusionResult { const NAME: &'static str = "Windows.Media.Core.LowLightFusionResult"; } impl ::core::convert::From<LowLightFusionResult> for ::windows::core::IUnknown { fn from(value: LowLightFusionResult) -> Self { value.0 .0 } } impl ::core::convert::From<&LowLightFusionResult> for ::windows::core::IUnknown { fn from(value: &LowLightFusionResult) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for LowLightFusionResult { 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 LowLightFusionResult { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<LowLightFusionResult> for ::windows::core::IInspectable { fn from(value: LowLightFusionResult) -> Self { value.0 } } impl ::core::convert::From<&LowLightFusionResult> for ::windows::core::IInspectable { fn from(value: &LowLightFusionResult) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for LowLightFusionResult { 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 LowLightFusionResult { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<LowLightFusionResult> for super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: LowLightFusionResult) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<&LowLightFusionResult> for super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: &LowLightFusionResult) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::IClosable> for LowLightFusionResult { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::IClosable> { ::windows::core::IntoParam::into_param(&self) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::IClosable> for &LowLightFusionResult { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::IClosable> { ::core::convert::TryInto::<super::super::Foundation::IClosable>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for LowLightFusionResult {} unsafe impl ::core::marker::Sync for LowLightFusionResult {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaBinder(pub ::windows::core::IInspectable); impl MediaBinder { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MediaBinder, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation")] pub fn Binding<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MediaBinder, MediaBindingEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveBinding<'a, Param0: ::windows::core::IntoParam<'a, 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() } } pub fn Token(&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 SetToken<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Source(&self) -> ::windows::core::Result<MediaSource> { 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::<MediaSource>(result__) } } } unsafe impl ::windows::core::RuntimeType for MediaBinder { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaBinder;{2b7e40aa-de07-424f-83f1-f1de46c4fa2e})"); } unsafe impl ::windows::core::Interface for MediaBinder { type Vtable = IMediaBinder_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2b7e40aa_de07_424f_83f1_f1de46c4fa2e); } impl ::windows::core::RuntimeName for MediaBinder { const NAME: &'static str = "Windows.Media.Core.MediaBinder"; } impl ::core::convert::From<MediaBinder> for ::windows::core::IUnknown { fn from(value: MediaBinder) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaBinder> for ::windows::core::IUnknown { fn from(value: &MediaBinder) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaBinder { 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 MediaBinder { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaBinder> for ::windows::core::IInspectable { fn from(value: MediaBinder) -> Self { value.0 } } impl ::core::convert::From<&MediaBinder> for ::windows::core::IInspectable { fn from(value: &MediaBinder) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaBinder { 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 MediaBinder { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaBinder {} unsafe impl ::core::marker::Sync for MediaBinder {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaBindingEventArgs(pub ::windows::core::IInspectable); impl MediaBindingEventArgs { #[cfg(feature = "Foundation")] pub fn Canceled<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MediaBindingEventArgs, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveCanceled<'a, Param0: ::windows::core::IntoParam<'a, 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() } } pub fn MediaBinder(&self) -> ::windows::core::Result<MediaBinder> { 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::<MediaBinder>(result__) } } #[cfg(feature = "Foundation")] pub fn GetDeferral(&self) -> ::windows::core::Result<super::super::Foundation::Deferral> { 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::Foundation::Deferral>(result__) } } #[cfg(feature = "Foundation")] pub fn SetUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(&self, uri: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), uri.into_param().abi()).ok() } } #[cfg(feature = "Storage_Streams")] pub fn SetStream<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStream>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, stream: Param0, contenttype: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), stream.into_param().abi(), contenttype.into_param().abi()).ok() } } #[cfg(feature = "Storage_Streams")] pub fn SetStreamReference<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStreamReference>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, stream: Param0, contenttype: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), stream.into_param().abi(), contenttype.into_param().abi()).ok() } } #[cfg(feature = "Media_Streaming_Adaptive")] pub fn SetAdaptiveMediaSource<'a, Param0: ::windows::core::IntoParam<'a, super::Streaming::Adaptive::AdaptiveMediaSource>>(&self, mediasource: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaBindingEventArgs2>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), mediasource.into_param().abi()).ok() } } #[cfg(feature = "Storage")] pub fn SetStorageFile<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::IStorageFile>>(&self, file: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaBindingEventArgs2>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), file.into_param().abi()).ok() } } #[cfg(feature = "Networking_BackgroundTransfer")] pub fn SetDownloadOperation<'a, Param0: ::windows::core::IntoParam<'a, super::super::Networking::BackgroundTransfer::DownloadOperation>>(&self, downloadoperation: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaBindingEventArgs3>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), downloadoperation.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for MediaBindingEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaBindingEventArgs;{b61cb25a-1b6d-4630-a86d-2f0837f712e5})"); } unsafe impl ::windows::core::Interface for MediaBindingEventArgs { type Vtable = IMediaBindingEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb61cb25a_1b6d_4630_a86d_2f0837f712e5); } impl ::windows::core::RuntimeName for MediaBindingEventArgs { const NAME: &'static str = "Windows.Media.Core.MediaBindingEventArgs"; } impl ::core::convert::From<MediaBindingEventArgs> for ::windows::core::IUnknown { fn from(value: MediaBindingEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaBindingEventArgs> for ::windows::core::IUnknown { fn from(value: &MediaBindingEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaBindingEventArgs { 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 MediaBindingEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaBindingEventArgs> for ::windows::core::IInspectable { fn from(value: MediaBindingEventArgs) -> Self { value.0 } } impl ::core::convert::From<&MediaBindingEventArgs> for ::windows::core::IInspectable { fn from(value: &MediaBindingEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaBindingEventArgs { 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 MediaBindingEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaBindingEventArgs {} unsafe impl ::core::marker::Sync for MediaBindingEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaCueEventArgs(pub ::windows::core::IInspectable); impl MediaCueEventArgs { pub fn Cue(&self) -> ::windows::core::Result<IMediaCue> { 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::<IMediaCue>(result__) } } } unsafe impl ::windows::core::RuntimeType for MediaCueEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaCueEventArgs;{d12f47f7-5fa4-4e68-9fe5-32160dcee57e})"); } unsafe impl ::windows::core::Interface for MediaCueEventArgs { type Vtable = IMediaCueEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd12f47f7_5fa4_4e68_9fe5_32160dcee57e); } impl ::windows::core::RuntimeName for MediaCueEventArgs { const NAME: &'static str = "Windows.Media.Core.MediaCueEventArgs"; } impl ::core::convert::From<MediaCueEventArgs> for ::windows::core::IUnknown { fn from(value: MediaCueEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaCueEventArgs> for ::windows::core::IUnknown { fn from(value: &MediaCueEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaCueEventArgs { 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 MediaCueEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaCueEventArgs> for ::windows::core::IInspectable { fn from(value: MediaCueEventArgs) -> Self { value.0 } } impl ::core::convert::From<&MediaCueEventArgs> for ::windows::core::IInspectable { fn from(value: &MediaCueEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaCueEventArgs { 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 MediaCueEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaCueEventArgs {} unsafe impl ::core::marker::Sync for MediaCueEventArgs {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct MediaDecoderStatus(pub i32); impl MediaDecoderStatus { pub const FullySupported: MediaDecoderStatus = MediaDecoderStatus(0i32); pub const UnsupportedSubtype: MediaDecoderStatus = MediaDecoderStatus(1i32); pub const UnsupportedEncoderProperties: MediaDecoderStatus = MediaDecoderStatus(2i32); pub const Degraded: MediaDecoderStatus = MediaDecoderStatus(3i32); } impl ::core::convert::From<i32> for MediaDecoderStatus { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for MediaDecoderStatus { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for MediaDecoderStatus { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.MediaDecoderStatus;i4)"); } impl ::windows::core::DefaultType for MediaDecoderStatus { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaSource(pub ::windows::core::IInspectable); impl MediaSource { #[cfg(feature = "Foundation")] pub fn OpenOperationCompleted<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MediaSource, MediaSourceOpenOperationCompletedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveOpenOperationCompleted<'a, Param0: ::windows::core::IntoParam<'a, 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_Collections")] pub fn CustomProperties(&self) -> ::windows::core::Result<super::super::Foundation::Collections::ValueSet> { 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::Foundation::Collections::ValueSet>(result__) } } #[cfg(feature = "Foundation")] pub fn Duration(&self) -> ::windows::core::Result<super::super::Foundation::IReference<super::super::Foundation::TimeSpan>> { 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::Foundation::IReference<super::super::Foundation::TimeSpan>>(result__) } } pub fn IsOpen(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ExternalTimedTextSources(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IObservableVector<TimedTextSource>> { 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::Foundation::Collections::IObservableVector<TimedTextSource>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ExternalTimedMetadataTracks(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IObservableVector<TimedMetadataTrack>> { 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::Foundation::Collections::IObservableVector<TimedMetadataTrack>>(result__) } } #[cfg(feature = "Foundation")] pub fn Close(&self) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::super::Foundation::IClosable>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this)).ok() } } #[cfg(feature = "Media_Streaming_Adaptive")] pub fn CreateFromAdaptiveMediaSource<'a, Param0: ::windows::core::IntoParam<'a, super::Streaming::Adaptive::AdaptiveMediaSource>>(mediasource: Param0) -> ::windows::core::Result<MediaSource> { Self::IMediaSourceStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), mediasource.into_param().abi(), &mut result__).from_abi::<MediaSource>(result__) }) } pub fn CreateFromMediaStreamSource<'a, Param0: ::windows::core::IntoParam<'a, MediaStreamSource>>(mediasource: Param0) -> ::windows::core::Result<MediaSource> { Self::IMediaSourceStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), mediasource.into_param().abi(), &mut result__).from_abi::<MediaSource>(result__) }) } pub fn CreateFromMseStreamSource<'a, Param0: ::windows::core::IntoParam<'a, MseStreamSource>>(mediasource: Param0) -> ::windows::core::Result<MediaSource> { Self::IMediaSourceStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), mediasource.into_param().abi(), &mut result__).from_abi::<MediaSource>(result__) }) } pub fn CreateFromIMediaSource<'a, Param0: ::windows::core::IntoParam<'a, IMediaSource>>(mediasource: Param0) -> ::windows::core::Result<MediaSource> { Self::IMediaSourceStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), mediasource.into_param().abi(), &mut result__).from_abi::<MediaSource>(result__) }) } #[cfg(feature = "Storage")] pub fn CreateFromStorageFile<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::IStorageFile>>(file: Param0) -> ::windows::core::Result<MediaSource> { Self::IMediaSourceStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), file.into_param().abi(), &mut result__).from_abi::<MediaSource>(result__) }) } #[cfg(feature = "Storage_Streams")] pub fn CreateFromStream<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStream>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(stream: Param0, contenttype: Param1) -> ::windows::core::Result<MediaSource> { Self::IMediaSourceStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), stream.into_param().abi(), contenttype.into_param().abi(), &mut result__).from_abi::<MediaSource>(result__) }) } #[cfg(feature = "Storage_Streams")] pub fn CreateFromStreamReference<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStreamReference>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(stream: Param0, contenttype: Param1) -> ::windows::core::Result<MediaSource> { Self::IMediaSourceStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), stream.into_param().abi(), contenttype.into_param().abi(), &mut result__).from_abi::<MediaSource>(result__) }) } #[cfg(feature = "Foundation")] pub fn CreateFromUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(uri: Param0) -> ::windows::core::Result<MediaSource> { Self::IMediaSourceStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), uri.into_param().abi(), &mut result__).from_abi::<MediaSource>(result__) }) } #[cfg(feature = "Foundation")] pub fn StateChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MediaSource, MediaSourceStateChangedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = &::windows::core::Interface::cast::<IMediaSource3>(self)?; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveStateChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaSource3>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } pub fn State(&self) -> ::windows::core::Result<MediaSourceState> { let this = &::windows::core::Interface::cast::<IMediaSource3>(self)?; unsafe { let mut result__: MediaSourceState = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MediaSourceState>(result__) } } pub fn Reset(&self) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaSource3>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this)).ok() } } pub fn CreateFromMediaBinder<'a, Param0: ::windows::core::IntoParam<'a, MediaBinder>>(binder: Param0) -> ::windows::core::Result<MediaSource> { Self::IMediaSourceStatics2(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), binder.into_param().abi(), &mut result__).from_abi::<MediaSource>(result__) }) } #[cfg(feature = "Media_Streaming_Adaptive")] pub fn AdaptiveMediaSource(&self) -> ::windows::core::Result<super::Streaming::Adaptive::AdaptiveMediaSource> { let this = &::windows::core::Interface::cast::<IMediaSource4>(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::<super::Streaming::Adaptive::AdaptiveMediaSource>(result__) } } pub fn MediaStreamSource(&self) -> ::windows::core::Result<MediaStreamSource> { let this = &::windows::core::Interface::cast::<IMediaSource4>(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::<MediaStreamSource>(result__) } } pub fn MseStreamSource(&self) -> ::windows::core::Result<MseStreamSource> { let this = &::windows::core::Interface::cast::<IMediaSource4>(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::<MseStreamSource>(result__) } } #[cfg(feature = "Foundation")] pub fn Uri(&self) -> ::windows::core::Result<super::super::Foundation::Uri> { let this = &::windows::core::Interface::cast::<IMediaSource4>(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::Foundation::Uri>(result__) } } #[cfg(feature = "Foundation")] pub fn OpenAsync(&self) -> ::windows::core::Result<super::super::Foundation::IAsyncAction> { let this = &::windows::core::Interface::cast::<IMediaSource4>(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::Foundation::IAsyncAction>(result__) } } #[cfg(feature = "Media_Capture_Frames")] pub fn CreateFromMediaFrameSource<'a, Param0: ::windows::core::IntoParam<'a, super::Capture::Frames::MediaFrameSource>>(framesource: Param0) -> ::windows::core::Result<MediaSource> { Self::IMediaSourceStatics3(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), framesource.into_param().abi(), &mut result__).from_abi::<MediaSource>(result__) }) } #[cfg(feature = "Networking_BackgroundTransfer")] pub fn DownloadOperation(&self) -> ::windows::core::Result<super::super::Networking::BackgroundTransfer::DownloadOperation> { let this = &::windows::core::Interface::cast::<IMediaSource5>(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::<super::super::Networking::BackgroundTransfer::DownloadOperation>(result__) } } #[cfg(feature = "Networking_BackgroundTransfer")] pub fn CreateFromDownloadOperation<'a, Param0: ::windows::core::IntoParam<'a, super::super::Networking::BackgroundTransfer::DownloadOperation>>(downloadoperation: Param0) -> ::windows::core::Result<MediaSource> { Self::IMediaSourceStatics4(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), downloadoperation.into_param().abi(), &mut result__).from_abi::<MediaSource>(result__) }) } pub fn IMediaSourceStatics<R, F: FnOnce(&IMediaSourceStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MediaSource, IMediaSourceStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn IMediaSourceStatics2<R, F: FnOnce(&IMediaSourceStatics2) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MediaSource, IMediaSourceStatics2> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn IMediaSourceStatics3<R, F: FnOnce(&IMediaSourceStatics3) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MediaSource, IMediaSourceStatics3> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn IMediaSourceStatics4<R, F: FnOnce(&IMediaSourceStatics4) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MediaSource, IMediaSourceStatics4> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for MediaSource { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaSource;{2eb61048-655f-4c37-b813-b4e45dfa0abe})"); } unsafe impl ::windows::core::Interface for MediaSource { type Vtable = IMediaSource2_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2eb61048_655f_4c37_b813_b4e45dfa0abe); } impl ::windows::core::RuntimeName for MediaSource { const NAME: &'static str = "Windows.Media.Core.MediaSource"; } impl ::core::convert::From<MediaSource> for ::windows::core::IUnknown { fn from(value: MediaSource) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaSource> for ::windows::core::IUnknown { fn from(value: &MediaSource) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaSource { 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 MediaSource { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaSource> for ::windows::core::IInspectable { fn from(value: MediaSource) -> Self { value.0 } } impl ::core::convert::From<&MediaSource> for ::windows::core::IInspectable { fn from(value: &MediaSource) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaSource { 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 MediaSource { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<MediaSource> for super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: MediaSource) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<&MediaSource> for super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: &MediaSource) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::IClosable> for MediaSource { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::IClosable> { ::windows::core::IntoParam::into_param(&self) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::IClosable> for &MediaSource { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::IClosable> { ::core::convert::TryInto::<super::super::Foundation::IClosable>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[cfg(feature = "Media_Playback")] impl ::core::convert::TryFrom<MediaSource> for super::Playback::IMediaPlaybackSource { type Error = ::windows::core::Error; fn try_from(value: MediaSource) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } #[cfg(feature = "Media_Playback")] impl ::core::convert::TryFrom<&MediaSource> for super::Playback::IMediaPlaybackSource { type Error = ::windows::core::Error; fn try_from(value: &MediaSource) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } #[cfg(feature = "Media_Playback")] impl<'a> ::windows::core::IntoParam<'a, super::Playback::IMediaPlaybackSource> for MediaSource { fn into_param(self) -> ::windows::core::Param<'a, super::Playback::IMediaPlaybackSource> { ::windows::core::IntoParam::into_param(&self) } } #[cfg(feature = "Media_Playback")] impl<'a> ::windows::core::IntoParam<'a, super::Playback::IMediaPlaybackSource> for &MediaSource { fn into_param(self) -> ::windows::core::Param<'a, super::Playback::IMediaPlaybackSource> { ::core::convert::TryInto::<super::Playback::IMediaPlaybackSource>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for MediaSource {} unsafe impl ::core::marker::Sync for MediaSource {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaSourceAppServiceConnection(pub ::windows::core::IInspectable); impl MediaSourceAppServiceConnection { #[cfg(feature = "Foundation")] pub fn InitializeMediaStreamSourceRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MediaSourceAppServiceConnection, InitializeMediaStreamSourceRequestedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveInitializeMediaStreamSourceRequested<'a, Param0: ::windows::core::IntoParam<'a, 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() } } pub fn Start(&self) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this)).ok() } } #[cfg(feature = "ApplicationModel_AppService")] pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, super::super::ApplicationModel::AppService::AppServiceConnection>>(appserviceconnection: Param0) -> ::windows::core::Result<MediaSourceAppServiceConnection> { Self::IMediaSourceAppServiceConnectionFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), appserviceconnection.into_param().abi(), &mut result__).from_abi::<MediaSourceAppServiceConnection>(result__) }) } pub fn IMediaSourceAppServiceConnectionFactory<R, F: FnOnce(&IMediaSourceAppServiceConnectionFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MediaSourceAppServiceConnection, IMediaSourceAppServiceConnectionFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for MediaSourceAppServiceConnection { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaSourceAppServiceConnection;{61e1ea97-1916-4810-b7f4-b642be829596})"); } unsafe impl ::windows::core::Interface for MediaSourceAppServiceConnection { type Vtable = IMediaSourceAppServiceConnection_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x61e1ea97_1916_4810_b7f4_b642be829596); } impl ::windows::core::RuntimeName for MediaSourceAppServiceConnection { const NAME: &'static str = "Windows.Media.Core.MediaSourceAppServiceConnection"; } impl ::core::convert::From<MediaSourceAppServiceConnection> for ::windows::core::IUnknown { fn from(value: MediaSourceAppServiceConnection) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaSourceAppServiceConnection> for ::windows::core::IUnknown { fn from(value: &MediaSourceAppServiceConnection) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaSourceAppServiceConnection { 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 MediaSourceAppServiceConnection { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaSourceAppServiceConnection> for ::windows::core::IInspectable { fn from(value: MediaSourceAppServiceConnection) -> Self { value.0 } } impl ::core::convert::From<&MediaSourceAppServiceConnection> for ::windows::core::IInspectable { fn from(value: &MediaSourceAppServiceConnection) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaSourceAppServiceConnection { 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 MediaSourceAppServiceConnection { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaSourceError(pub ::windows::core::IInspectable); impl MediaSourceError { pub fn ExtendedError(&self) -> ::windows::core::Result<::windows::core::HRESULT> { let this = self; unsafe { let mut result__: ::windows::core::HRESULT = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HRESULT>(result__) } } } unsafe impl ::windows::core::RuntimeType for MediaSourceError { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaSourceError;{5c0a8965-37c5-4e9d-8d21-1cdee90cecc6})"); } unsafe impl ::windows::core::Interface for MediaSourceError { type Vtable = IMediaSourceError_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5c0a8965_37c5_4e9d_8d21_1cdee90cecc6); } impl ::windows::core::RuntimeName for MediaSourceError { const NAME: &'static str = "Windows.Media.Core.MediaSourceError"; } impl ::core::convert::From<MediaSourceError> for ::windows::core::IUnknown { fn from(value: MediaSourceError) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaSourceError> for ::windows::core::IUnknown { fn from(value: &MediaSourceError) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaSourceError { 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 MediaSourceError { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaSourceError> for ::windows::core::IInspectable { fn from(value: MediaSourceError) -> Self { value.0 } } impl ::core::convert::From<&MediaSourceError> for ::windows::core::IInspectable { fn from(value: &MediaSourceError) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaSourceError { 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 MediaSourceError { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaSourceError {} unsafe impl ::core::marker::Sync for MediaSourceError {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaSourceOpenOperationCompletedEventArgs(pub ::windows::core::IInspectable); impl MediaSourceOpenOperationCompletedEventArgs { pub fn Error(&self) -> ::windows::core::Result<MediaSourceError> { 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::<MediaSourceError>(result__) } } } unsafe impl ::windows::core::RuntimeType for MediaSourceOpenOperationCompletedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaSourceOpenOperationCompletedEventArgs;{fc682ceb-e281-477c-a8e0-1acd654114c8})"); } unsafe impl ::windows::core::Interface for MediaSourceOpenOperationCompletedEventArgs { type Vtable = IMediaSourceOpenOperationCompletedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xfc682ceb_e281_477c_a8e0_1acd654114c8); } impl ::windows::core::RuntimeName for MediaSourceOpenOperationCompletedEventArgs { const NAME: &'static str = "Windows.Media.Core.MediaSourceOpenOperationCompletedEventArgs"; } impl ::core::convert::From<MediaSourceOpenOperationCompletedEventArgs> for ::windows::core::IUnknown { fn from(value: MediaSourceOpenOperationCompletedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaSourceOpenOperationCompletedEventArgs> for ::windows::core::IUnknown { fn from(value: &MediaSourceOpenOperationCompletedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaSourceOpenOperationCompletedEventArgs { 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 MediaSourceOpenOperationCompletedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaSourceOpenOperationCompletedEventArgs> for ::windows::core::IInspectable { fn from(value: MediaSourceOpenOperationCompletedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&MediaSourceOpenOperationCompletedEventArgs> for ::windows::core::IInspectable { fn from(value: &MediaSourceOpenOperationCompletedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaSourceOpenOperationCompletedEventArgs { 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 MediaSourceOpenOperationCompletedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaSourceOpenOperationCompletedEventArgs {} unsafe impl ::core::marker::Sync for MediaSourceOpenOperationCompletedEventArgs {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct MediaSourceState(pub i32); impl MediaSourceState { pub const Initial: MediaSourceState = MediaSourceState(0i32); pub const Opening: MediaSourceState = MediaSourceState(1i32); pub const Opened: MediaSourceState = MediaSourceState(2i32); pub const Failed: MediaSourceState = MediaSourceState(3i32); pub const Closed: MediaSourceState = MediaSourceState(4i32); } impl ::core::convert::From<i32> for MediaSourceState { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for MediaSourceState { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for MediaSourceState { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.MediaSourceState;i4)"); } impl ::windows::core::DefaultType for MediaSourceState { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaSourceStateChangedEventArgs(pub ::windows::core::IInspectable); impl MediaSourceStateChangedEventArgs { pub fn OldState(&self) -> ::windows::core::Result<MediaSourceState> { let this = self; unsafe { let mut result__: MediaSourceState = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MediaSourceState>(result__) } } pub fn NewState(&self) -> ::windows::core::Result<MediaSourceState> { let this = self; unsafe { let mut result__: MediaSourceState = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MediaSourceState>(result__) } } } unsafe impl ::windows::core::RuntimeType for MediaSourceStateChangedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaSourceStateChangedEventArgs;{0a30af82-9071-4bac-bc39-ca2a93b717a9})"); } unsafe impl ::windows::core::Interface for MediaSourceStateChangedEventArgs { type Vtable = IMediaSourceStateChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0a30af82_9071_4bac_bc39_ca2a93b717a9); } impl ::windows::core::RuntimeName for MediaSourceStateChangedEventArgs { const NAME: &'static str = "Windows.Media.Core.MediaSourceStateChangedEventArgs"; } impl ::core::convert::From<MediaSourceStateChangedEventArgs> for ::windows::core::IUnknown { fn from(value: MediaSourceStateChangedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaSourceStateChangedEventArgs> for ::windows::core::IUnknown { fn from(value: &MediaSourceStateChangedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaSourceStateChangedEventArgs { 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 MediaSourceStateChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaSourceStateChangedEventArgs> for ::windows::core::IInspectable { fn from(value: MediaSourceStateChangedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&MediaSourceStateChangedEventArgs> for ::windows::core::IInspectable { fn from(value: &MediaSourceStateChangedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaSourceStateChangedEventArgs { 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 MediaSourceStateChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaSourceStateChangedEventArgs {} unsafe impl ::core::marker::Sync for MediaSourceStateChangedEventArgs {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct MediaSourceStatus(pub i32); impl MediaSourceStatus { pub const FullySupported: MediaSourceStatus = MediaSourceStatus(0i32); pub const Unknown: MediaSourceStatus = MediaSourceStatus(1i32); } impl ::core::convert::From<i32> for MediaSourceStatus { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for MediaSourceStatus { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for MediaSourceStatus { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.MediaSourceStatus;i4)"); } impl ::windows::core::DefaultType for MediaSourceStatus { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSample(pub ::windows::core::IInspectable); impl MediaStreamSample { #[cfg(feature = "Foundation")] pub fn Processed<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MediaStreamSample, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveProcessed<'a, Param0: ::windows::core::IntoParam<'a, 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 = "Storage_Streams")] pub fn Buffer(&self) -> ::windows::core::Result<super::super::Storage::Streams::Buffer> { 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::Storage::Streams::Buffer>(result__) } } #[cfg(feature = "Foundation")] pub fn Timestamp(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ExtendedProperties(&self) -> ::windows::core::Result<MediaStreamSamplePropertySet> { 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::<MediaStreamSamplePropertySet>(result__) } } pub fn Protection(&self) -> ::windows::core::Result<MediaStreamSampleProtectionProperties> { 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::<MediaStreamSampleProtectionProperties>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDecodeTimestamp<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn DecodeTimestamp(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDuration<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Duration(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } pub fn SetKeyFrame(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), value).ok() } } pub fn KeyFrame(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetDiscontinuous(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), value).ok() } } pub fn Discontinuous(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).19)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } #[cfg(all(feature = "Foundation", feature = "Storage_Streams"))] pub fn CreateFromBuffer<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IBuffer>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(buffer: Param0, timestamp: Param1) -> ::windows::core::Result<MediaStreamSample> { Self::IMediaStreamSampleStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), buffer.into_param().abi(), timestamp.into_param().abi(), &mut result__).from_abi::<MediaStreamSample>(result__) }) } #[cfg(all(feature = "Foundation", feature = "Storage_Streams"))] pub fn CreateFromStreamAsync<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IInputStream>, Param2: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(stream: Param0, count: u32, timestamp: Param2) -> ::windows::core::Result<super::super::Foundation::IAsyncOperation<MediaStreamSample>> { Self::IMediaStreamSampleStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), stream.into_param().abi(), count, timestamp.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::IAsyncOperation<MediaStreamSample>>(result__) }) } #[cfg(feature = "Graphics_DirectX_Direct3D11")] pub fn Direct3D11Surface(&self) -> ::windows::core::Result<super::super::Graphics::DirectX::Direct3D11::IDirect3DSurface> { let this = &::windows::core::Interface::cast::<IMediaStreamSample2>(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::<super::super::Graphics::DirectX::Direct3D11::IDirect3DSurface>(result__) } } #[cfg(all(feature = "Foundation", feature = "Graphics_DirectX_Direct3D11"))] pub fn CreateFromDirect3D11Surface<'a, Param0: ::windows::core::IntoParam<'a, super::super::Graphics::DirectX::Direct3D11::IDirect3DSurface>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(surface: Param0, timestamp: Param1) -> ::windows::core::Result<MediaStreamSample> { Self::IMediaStreamSampleStatics2(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), surface.into_param().abi(), timestamp.into_param().abi(), &mut result__).from_abi::<MediaStreamSample>(result__) }) } pub fn IMediaStreamSampleStatics<R, F: FnOnce(&IMediaStreamSampleStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MediaStreamSample, IMediaStreamSampleStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn IMediaStreamSampleStatics2<R, F: FnOnce(&IMediaStreamSampleStatics2) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MediaStreamSample, IMediaStreamSampleStatics2> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSample { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSample;{5c8db627-4b80-4361-9837-6cb7481ad9d6})"); } unsafe impl ::windows::core::Interface for MediaStreamSample { type Vtable = IMediaStreamSample_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x5c8db627_4b80_4361_9837_6cb7481ad9d6); } impl ::windows::core::RuntimeName for MediaStreamSample { const NAME: &'static str = "Windows.Media.Core.MediaStreamSample"; } impl ::core::convert::From<MediaStreamSample> for ::windows::core::IUnknown { fn from(value: MediaStreamSample) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSample> for ::windows::core::IUnknown { fn from(value: &MediaStreamSample) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSample { 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 MediaStreamSample { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSample> for ::windows::core::IInspectable { fn from(value: MediaStreamSample) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSample> for ::windows::core::IInspectable { fn from(value: &MediaStreamSample) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSample { 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 MediaStreamSample { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSample {} unsafe impl ::core::marker::Sync for MediaStreamSample {} #[cfg(feature = "Foundation_Collections")] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSamplePropertySet(pub ::windows::core::IInspectable); #[cfg(feature = "Foundation_Collections")] impl MediaStreamSamplePropertySet { #[cfg(feature = "Foundation_Collections")] pub fn Lookup<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, key: Param0) -> ::windows::core::Result<::windows::core::IInspectable> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), key.into_param().abi(), &mut result__).from_abi::<::windows::core::IInspectable>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Size(&self) -> ::windows::core::Result<u32> { let this = self; unsafe { let mut result__: u32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<u32>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn HasKey<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, key: Param0) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), key.into_param().abi(), &mut result__).from_abi::<bool>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn GetView(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IMapView<::windows::core::GUID, ::windows::core::IInspectable>> { 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::Foundation::Collections::IMapView<::windows::core::GUID, ::windows::core::IInspectable>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Insert<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>, Param1: ::windows::core::IntoParam<'a, ::windows::core::IInspectable>>(&self, key: Param0, value: Param1) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), key.into_param().abi(), value.into_param().abi(), &mut result__).from_abi::<bool>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Remove<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::GUID>>(&self, key: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), key.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn Clear(&self) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this)).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn First(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IIterator<super::super::Foundation::Collections::IKeyValuePair<::windows::core::GUID, ::windows::core::IInspectable>>> { let this = &::windows::core::Interface::cast::<super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::GUID, ::windows::core::IInspectable>>>(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::<super::super::Foundation::Collections::IIterator<super::super::Foundation::Collections::IKeyValuePair<::windows::core::GUID, ::windows::core::IInspectable>>>(result__) } } } #[cfg(feature = "Foundation_Collections")] unsafe impl ::windows::core::RuntimeType for MediaStreamSamplePropertySet { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSamplePropertySet;pinterface({3c2925fe-8519-45c1-aa79-197b6718c1c1};g16;cinterface(IInspectable)))"); } #[cfg(feature = "Foundation_Collections")] unsafe impl ::windows::core::Interface for MediaStreamSamplePropertySet { type Vtable = super::super::Foundation::Collections::IMap_abi<::windows::core::GUID, ::windows::core::IInspectable>; const IID: ::windows::core::GUID = ::windows::core::GUID::from_signature(<super::super::Foundation::Collections::IMap<::windows::core::GUID, ::windows::core::IInspectable> as ::windows::core::RuntimeType>::SIGNATURE); } #[cfg(feature = "Foundation_Collections")] impl ::windows::core::RuntimeName for MediaStreamSamplePropertySet { const NAME: &'static str = "Windows.Media.Core.MediaStreamSamplePropertySet"; } #[cfg(feature = "Foundation_Collections")] impl ::core::convert::From<MediaStreamSamplePropertySet> for ::windows::core::IUnknown { fn from(value: MediaStreamSamplePropertySet) -> Self { value.0 .0 } } #[cfg(feature = "Foundation_Collections")] impl ::core::convert::From<&MediaStreamSamplePropertySet> for ::windows::core::IUnknown { fn from(value: &MediaStreamSamplePropertySet) -> Self { value.0 .0.clone() } } #[cfg(feature = "Foundation_Collections")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSamplePropertySet { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } #[cfg(feature = "Foundation_Collections")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a MediaStreamSamplePropertySet { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } #[cfg(feature = "Foundation_Collections")] impl ::core::convert::From<MediaStreamSamplePropertySet> for ::windows::core::IInspectable { fn from(value: MediaStreamSamplePropertySet) -> Self { value.0 } } #[cfg(feature = "Foundation_Collections")] impl ::core::convert::From<&MediaStreamSamplePropertySet> for ::windows::core::IInspectable { fn from(value: &MediaStreamSamplePropertySet) -> Self { value.0.clone() } } #[cfg(feature = "Foundation_Collections")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSamplePropertySet { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } #[cfg(feature = "Foundation_Collections")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a MediaStreamSamplePropertySet { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Foundation_Collections")] impl ::core::convert::From<MediaStreamSamplePropertySet> for super::super::Foundation::Collections::IMap<::windows::core::GUID, ::windows::core::IInspectable> { fn from(value: MediaStreamSamplePropertySet) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Foundation_Collections")] impl ::core::convert::From<&MediaStreamSamplePropertySet> for super::super::Foundation::Collections::IMap<::windows::core::GUID, ::windows::core::IInspectable> { fn from(value: &MediaStreamSamplePropertySet) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Foundation_Collections")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IMap<::windows::core::GUID, ::windows::core::IInspectable>> for MediaStreamSamplePropertySet { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::Collections::IMap<::windows::core::GUID, ::windows::core::IInspectable>> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Foundation_Collections")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IMap<::windows::core::GUID, ::windows::core::IInspectable>> for &MediaStreamSamplePropertySet { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::Collections::IMap<::windows::core::GUID, ::windows::core::IInspectable>> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Foundation_Collections")] impl ::core::convert::TryFrom<MediaStreamSamplePropertySet> for super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::GUID, ::windows::core::IInspectable>> { type Error = ::windows::core::Error; fn try_from(value: MediaStreamSamplePropertySet) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } #[cfg(feature = "Foundation_Collections")] impl ::core::convert::TryFrom<&MediaStreamSamplePropertySet> for super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::GUID, ::windows::core::IInspectable>> { type Error = ::windows::core::Error; fn try_from(value: &MediaStreamSamplePropertySet) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } #[cfg(feature = "Foundation_Collections")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::GUID, ::windows::core::IInspectable>>> for MediaStreamSamplePropertySet { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::GUID, ::windows::core::IInspectable>>> { ::windows::core::IntoParam::into_param(&self) } } #[cfg(feature = "Foundation_Collections")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::GUID, ::windows::core::IInspectable>>> for &MediaStreamSamplePropertySet { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::GUID, ::windows::core::IInspectable>>> { ::core::convert::TryInto::<super::super::Foundation::Collections::IIterable<super::super::Foundation::Collections::IKeyValuePair<::windows::core::GUID, ::windows::core::IInspectable>>>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } #[cfg(feature = "Foundation_Collections")] unsafe impl ::core::marker::Send for MediaStreamSamplePropertySet {} #[cfg(feature = "Foundation_Collections")] unsafe impl ::core::marker::Sync for MediaStreamSamplePropertySet {} #[cfg(all(feature = "Foundation_Collections"))] impl ::core::iter::IntoIterator for MediaStreamSamplePropertySet { type Item = super::super::Foundation::Collections::IKeyValuePair<::windows::core::GUID, ::windows::core::IInspectable>; type IntoIter = super::super::Foundation::Collections::IIterator<Self::Item>; fn into_iter(self) -> Self::IntoIter { ::core::iter::IntoIterator::into_iter(&self) } } #[cfg(all(feature = "Foundation_Collections"))] impl ::core::iter::IntoIterator for &MediaStreamSamplePropertySet { type Item = super::super::Foundation::Collections::IKeyValuePair<::windows::core::GUID, ::windows::core::IInspectable>; type IntoIter = super::super::Foundation::Collections::IIterator<Self::Item>; fn into_iter(self) -> Self::IntoIter { self.First().unwrap() } } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSampleProtectionProperties(pub ::windows::core::IInspectable); impl MediaStreamSampleProtectionProperties { pub fn SetKeyIdentifier(&self, value: &[<u8 as ::windows::core::DefaultType>::DefaultType]) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.len() as u32, ::core::mem::transmute(value.as_ptr())).ok() } } pub fn GetKeyIdentifier(&self, value: &mut ::windows::core::Array<u8>) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.set_abi_len(), value as *mut _ as _).ok() } } pub fn SetInitializationVector(&self, value: &[<u8 as ::windows::core::DefaultType>::DefaultType]) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.len() as u32, ::core::mem::transmute(value.as_ptr())).ok() } } pub fn GetInitializationVector(&self, value: &mut ::windows::core::Array<u8>) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.set_abi_len(), value as *mut _ as _).ok() } } pub fn SetSubSampleMapping(&self, value: &[<u8 as ::windows::core::DefaultType>::DefaultType]) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.len() as u32, ::core::mem::transmute(value.as_ptr())).ok() } } pub fn GetSubSampleMapping(&self, value: &mut ::windows::core::Array<u8>) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.set_abi_len(), value as *mut _ as _).ok() } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSampleProtectionProperties { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSampleProtectionProperties;{4eb88292-ecdf-493e-841d-dd4add7caca2})"); } unsafe impl ::windows::core::Interface for MediaStreamSampleProtectionProperties { type Vtable = IMediaStreamSampleProtectionProperties_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4eb88292_ecdf_493e_841d_dd4add7caca2); } impl ::windows::core::RuntimeName for MediaStreamSampleProtectionProperties { const NAME: &'static str = "Windows.Media.Core.MediaStreamSampleProtectionProperties"; } impl ::core::convert::From<MediaStreamSampleProtectionProperties> for ::windows::core::IUnknown { fn from(value: MediaStreamSampleProtectionProperties) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSampleProtectionProperties> for ::windows::core::IUnknown { fn from(value: &MediaStreamSampleProtectionProperties) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSampleProtectionProperties { 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 MediaStreamSampleProtectionProperties { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSampleProtectionProperties> for ::windows::core::IInspectable { fn from(value: MediaStreamSampleProtectionProperties) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSampleProtectionProperties> for ::windows::core::IInspectable { fn from(value: &MediaStreamSampleProtectionProperties) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSampleProtectionProperties { 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 MediaStreamSampleProtectionProperties { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSampleProtectionProperties {} unsafe impl ::core::marker::Sync for MediaStreamSampleProtectionProperties {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSource(pub ::windows::core::IInspectable); impl MediaStreamSource { #[cfg(feature = "Foundation")] pub fn Closed<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MediaStreamSource, MediaStreamSourceClosedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveClosed<'a, Param0: ::windows::core::IntoParam<'a, 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 Starting<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MediaStreamSource, MediaStreamSourceStartingEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveStarting<'a, Param0: ::windows::core::IntoParam<'a, 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 Paused<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MediaStreamSource, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemovePaused<'a, Param0: ::windows::core::IntoParam<'a, 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 SampleRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MediaStreamSource, MediaStreamSourceSampleRequestedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveSampleRequested<'a, Param0: ::windows::core::IntoParam<'a, 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 SwitchStreamsRequested<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MediaStreamSource, MediaStreamSourceSwitchStreamsRequestedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveSwitchStreamsRequested<'a, Param0: ::windows::core::IntoParam<'a, 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() } } pub fn NotifyError(&self, errorstatus: MediaStreamSourceErrorStatus) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), errorstatus).ok() } } pub fn AddStreamDescriptor<'a, Param0: ::windows::core::IntoParam<'a, IMediaStreamDescriptor>>(&self, descriptor: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), descriptor.into_param().abi()).ok() } } #[cfg(feature = "Media_Protection")] pub fn SetMediaProtectionManager<'a, Param0: ::windows::core::IntoParam<'a, super::Protection::MediaProtectionManager>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Media_Protection")] pub fn MediaProtectionManager(&self) -> ::windows::core::Result<super::Protection::MediaProtectionManager> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).19)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::Protection::MediaProtectionManager>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDuration<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).20)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Duration(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).21)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } pub fn SetCanSeek(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).22)(::core::mem::transmute_copy(this), value).ok() } } pub fn CanSeek(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).23)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } #[cfg(feature = "Foundation")] pub fn SetBufferTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).24)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn BufferTime(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).25)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn SetBufferedRange<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, startoffset: Param0, endoffset: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).26)(::core::mem::transmute_copy(this), startoffset.into_param().abi(), endoffset.into_param().abi()).ok() } } #[cfg(feature = "Storage_FileProperties")] pub fn MusicProperties(&self) -> ::windows::core::Result<super::super::Storage::FileProperties::MusicProperties> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).27)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Storage::FileProperties::MusicProperties>(result__) } } #[cfg(feature = "Storage_FileProperties")] pub fn VideoProperties(&self) -> ::windows::core::Result<super::super::Storage::FileProperties::VideoProperties> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).28)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Storage::FileProperties::VideoProperties>(result__) } } #[cfg(feature = "Storage_Streams")] pub fn SetThumbnail<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStreamReference>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).29)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Storage_Streams")] pub fn Thumbnail(&self) -> ::windows::core::Result<super::super::Storage::Streams::IRandomAccessStreamReference> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).30)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Storage::Streams::IRandomAccessStreamReference>(result__) } } pub fn AddProtectionKey<'a, Param0: ::windows::core::IntoParam<'a, IMediaStreamDescriptor>>(&self, streamdescriptor: Param0, keyidentifier: &[<u8 as ::windows::core::DefaultType>::DefaultType], licensedata: &[<u8 as ::windows::core::DefaultType>::DefaultType]) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).31)(::core::mem::transmute_copy(this), streamdescriptor.into_param().abi(), keyidentifier.len() as u32, ::core::mem::transmute(keyidentifier.as_ptr()), licensedata.len() as u32, ::core::mem::transmute(licensedata.as_ptr())).ok() } } pub fn CreateFromDescriptor<'a, Param0: ::windows::core::IntoParam<'a, IMediaStreamDescriptor>>(descriptor: Param0) -> ::windows::core::Result<MediaStreamSource> { Self::IMediaStreamSourceFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), descriptor.into_param().abi(), &mut result__).from_abi::<MediaStreamSource>(result__) }) } pub fn CreateFromDescriptors<'a, Param0: ::windows::core::IntoParam<'a, IMediaStreamDescriptor>, Param1: ::windows::core::IntoParam<'a, IMediaStreamDescriptor>>(descriptor: Param0, descriptor2: Param1) -> ::windows::core::Result<MediaStreamSource> { Self::IMediaStreamSourceFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), descriptor.into_param().abi(), descriptor2.into_param().abi(), &mut result__).from_abi::<MediaStreamSource>(result__) }) } #[cfg(feature = "Foundation")] pub fn SampleRendered<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MediaStreamSource, MediaStreamSourceSampleRenderedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = &::windows::core::Interface::cast::<IMediaStreamSource2>(self)?; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveSampleRendered<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaStreamSource2>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn SetMaxSupportedPlaybackRate<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<f64>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaStreamSource3>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn MaxSupportedPlaybackRate(&self) -> ::windows::core::Result<super::super::Foundation::IReference<f64>> { let this = &::windows::core::Interface::cast::<IMediaStreamSource3>(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::Foundation::IReference<f64>>(result__) } } pub fn SetIsLive(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaStreamSource4>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value).ok() } } pub fn IsLive(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<IMediaStreamSource4>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn IMediaStreamSourceFactory<R, F: FnOnce(&IMediaStreamSourceFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MediaStreamSource, IMediaStreamSourceFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSource { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSource;{3712d543-45eb-4138-aa62-c01e26f3843f})"); } unsafe impl ::windows::core::Interface for MediaStreamSource { type Vtable = IMediaStreamSource_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3712d543_45eb_4138_aa62_c01e26f3843f); } impl ::windows::core::RuntimeName for MediaStreamSource { const NAME: &'static str = "Windows.Media.Core.MediaStreamSource"; } impl ::core::convert::From<MediaStreamSource> for ::windows::core::IUnknown { fn from(value: MediaStreamSource) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSource> for ::windows::core::IUnknown { fn from(value: &MediaStreamSource) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSource { 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 MediaStreamSource { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSource> for ::windows::core::IInspectable { fn from(value: MediaStreamSource) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSource> for ::windows::core::IInspectable { fn from(value: &MediaStreamSource) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSource { 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 MediaStreamSource { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<MediaStreamSource> for IMediaSource { type Error = ::windows::core::Error; fn try_from(value: MediaStreamSource) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&MediaStreamSource> for IMediaSource { type Error = ::windows::core::Error; fn try_from(value: &MediaStreamSource) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaSource> for MediaStreamSource { fn into_param(self) -> ::windows::core::Param<'a, IMediaSource> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaSource> for &MediaStreamSource { fn into_param(self) -> ::windows::core::Param<'a, IMediaSource> { ::core::convert::TryInto::<IMediaSource>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for MediaStreamSource {} unsafe impl ::core::marker::Sync for MediaStreamSource {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSourceClosedEventArgs(pub ::windows::core::IInspectable); impl MediaStreamSourceClosedEventArgs { pub fn Request(&self) -> ::windows::core::Result<MediaStreamSourceClosedRequest> { 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::<MediaStreamSourceClosedRequest>(result__) } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceClosedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSourceClosedEventArgs;{cd8c7eb2-4816-4e24-88f0-491ef7386406})"); } unsafe impl ::windows::core::Interface for MediaStreamSourceClosedEventArgs { type Vtable = IMediaStreamSourceClosedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xcd8c7eb2_4816_4e24_88f0_491ef7386406); } impl ::windows::core::RuntimeName for MediaStreamSourceClosedEventArgs { const NAME: &'static str = "Windows.Media.Core.MediaStreamSourceClosedEventArgs"; } impl ::core::convert::From<MediaStreamSourceClosedEventArgs> for ::windows::core::IUnknown { fn from(value: MediaStreamSourceClosedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSourceClosedEventArgs> for ::windows::core::IUnknown { fn from(value: &MediaStreamSourceClosedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSourceClosedEventArgs { 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 MediaStreamSourceClosedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSourceClosedEventArgs> for ::windows::core::IInspectable { fn from(value: MediaStreamSourceClosedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSourceClosedEventArgs> for ::windows::core::IInspectable { fn from(value: &MediaStreamSourceClosedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSourceClosedEventArgs { 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 MediaStreamSourceClosedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSourceClosedEventArgs {} unsafe impl ::core::marker::Sync for MediaStreamSourceClosedEventArgs {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct MediaStreamSourceClosedReason(pub i32); impl MediaStreamSourceClosedReason { pub const Done: MediaStreamSourceClosedReason = MediaStreamSourceClosedReason(0i32); pub const UnknownError: MediaStreamSourceClosedReason = MediaStreamSourceClosedReason(1i32); pub const AppReportedError: MediaStreamSourceClosedReason = MediaStreamSourceClosedReason(2i32); pub const UnsupportedProtectionSystem: MediaStreamSourceClosedReason = MediaStreamSourceClosedReason(3i32); pub const ProtectionSystemFailure: MediaStreamSourceClosedReason = MediaStreamSourceClosedReason(4i32); pub const UnsupportedEncodingFormat: MediaStreamSourceClosedReason = MediaStreamSourceClosedReason(5i32); pub const MissingSampleRequestedEventHandler: MediaStreamSourceClosedReason = MediaStreamSourceClosedReason(6i32); } impl ::core::convert::From<i32> for MediaStreamSourceClosedReason { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for MediaStreamSourceClosedReason { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceClosedReason { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.MediaStreamSourceClosedReason;i4)"); } impl ::windows::core::DefaultType for MediaStreamSourceClosedReason { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSourceClosedRequest(pub ::windows::core::IInspectable); impl MediaStreamSourceClosedRequest { pub fn Reason(&self) -> ::windows::core::Result<MediaStreamSourceClosedReason> { let this = self; unsafe { let mut result__: MediaStreamSourceClosedReason = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MediaStreamSourceClosedReason>(result__) } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceClosedRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSourceClosedRequest;{907c00e9-18a3-4951-887a-2c1eebd5c69e})"); } unsafe impl ::windows::core::Interface for MediaStreamSourceClosedRequest { type Vtable = IMediaStreamSourceClosedRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x907c00e9_18a3_4951_887a_2c1eebd5c69e); } impl ::windows::core::RuntimeName for MediaStreamSourceClosedRequest { const NAME: &'static str = "Windows.Media.Core.MediaStreamSourceClosedRequest"; } impl ::core::convert::From<MediaStreamSourceClosedRequest> for ::windows::core::IUnknown { fn from(value: MediaStreamSourceClosedRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSourceClosedRequest> for ::windows::core::IUnknown { fn from(value: &MediaStreamSourceClosedRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSourceClosedRequest { 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 MediaStreamSourceClosedRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSourceClosedRequest> for ::windows::core::IInspectable { fn from(value: MediaStreamSourceClosedRequest) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSourceClosedRequest> for ::windows::core::IInspectable { fn from(value: &MediaStreamSourceClosedRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSourceClosedRequest { 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 MediaStreamSourceClosedRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSourceClosedRequest {} unsafe impl ::core::marker::Sync for MediaStreamSourceClosedRequest {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct MediaStreamSourceErrorStatus(pub i32); impl MediaStreamSourceErrorStatus { pub const Other: MediaStreamSourceErrorStatus = MediaStreamSourceErrorStatus(0i32); pub const OutOfMemory: MediaStreamSourceErrorStatus = MediaStreamSourceErrorStatus(1i32); pub const FailedToOpenFile: MediaStreamSourceErrorStatus = MediaStreamSourceErrorStatus(2i32); pub const FailedToConnectToServer: MediaStreamSourceErrorStatus = MediaStreamSourceErrorStatus(3i32); pub const ConnectionToServerLost: MediaStreamSourceErrorStatus = MediaStreamSourceErrorStatus(4i32); pub const UnspecifiedNetworkError: MediaStreamSourceErrorStatus = MediaStreamSourceErrorStatus(5i32); pub const DecodeError: MediaStreamSourceErrorStatus = MediaStreamSourceErrorStatus(6i32); pub const UnsupportedMediaFormat: MediaStreamSourceErrorStatus = MediaStreamSourceErrorStatus(7i32); } impl ::core::convert::From<i32> for MediaStreamSourceErrorStatus { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for MediaStreamSourceErrorStatus { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceErrorStatus { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.MediaStreamSourceErrorStatus;i4)"); } impl ::windows::core::DefaultType for MediaStreamSourceErrorStatus { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSourceSampleRenderedEventArgs(pub ::windows::core::IInspectable); impl MediaStreamSourceSampleRenderedEventArgs { #[cfg(feature = "Foundation")] pub fn SampleLag(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceSampleRenderedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSourceSampleRenderedEventArgs;{9d697b05-d4f2-4c7a-9dfe-8d6cd0b3ee84})"); } unsafe impl ::windows::core::Interface for MediaStreamSourceSampleRenderedEventArgs { type Vtable = IMediaStreamSourceSampleRenderedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9d697b05_d4f2_4c7a_9dfe_8d6cd0b3ee84); } impl ::windows::core::RuntimeName for MediaStreamSourceSampleRenderedEventArgs { const NAME: &'static str = "Windows.Media.Core.MediaStreamSourceSampleRenderedEventArgs"; } impl ::core::convert::From<MediaStreamSourceSampleRenderedEventArgs> for ::windows::core::IUnknown { fn from(value: MediaStreamSourceSampleRenderedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSourceSampleRenderedEventArgs> for ::windows::core::IUnknown { fn from(value: &MediaStreamSourceSampleRenderedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSourceSampleRenderedEventArgs { 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 MediaStreamSourceSampleRenderedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSourceSampleRenderedEventArgs> for ::windows::core::IInspectable { fn from(value: MediaStreamSourceSampleRenderedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSourceSampleRenderedEventArgs> for ::windows::core::IInspectable { fn from(value: &MediaStreamSourceSampleRenderedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSourceSampleRenderedEventArgs { 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 MediaStreamSourceSampleRenderedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSourceSampleRenderedEventArgs {} unsafe impl ::core::marker::Sync for MediaStreamSourceSampleRenderedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSourceSampleRequest(pub ::windows::core::IInspectable); impl MediaStreamSourceSampleRequest { pub fn StreamDescriptor(&self) -> ::windows::core::Result<IMediaStreamDescriptor> { 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::<IMediaStreamDescriptor>(result__) } } pub fn GetDeferral(&self) -> ::windows::core::Result<MediaStreamSourceSampleRequestDeferral> { 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::<MediaStreamSourceSampleRequestDeferral>(result__) } } pub fn SetSample<'a, Param0: ::windows::core::IntoParam<'a, MediaStreamSample>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Sample(&self) -> ::windows::core::Result<MediaStreamSample> { 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::<MediaStreamSample>(result__) } } pub fn ReportSampleProgress(&self, progress: u32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), progress).ok() } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceSampleRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSourceSampleRequest;{4db341a9-3501-4d9b-83f9-8f235c822532})"); } unsafe impl ::windows::core::Interface for MediaStreamSourceSampleRequest { type Vtable = IMediaStreamSourceSampleRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4db341a9_3501_4d9b_83f9_8f235c822532); } impl ::windows::core::RuntimeName for MediaStreamSourceSampleRequest { const NAME: &'static str = "Windows.Media.Core.MediaStreamSourceSampleRequest"; } impl ::core::convert::From<MediaStreamSourceSampleRequest> for ::windows::core::IUnknown { fn from(value: MediaStreamSourceSampleRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSourceSampleRequest> for ::windows::core::IUnknown { fn from(value: &MediaStreamSourceSampleRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSourceSampleRequest { 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 MediaStreamSourceSampleRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSourceSampleRequest> for ::windows::core::IInspectable { fn from(value: MediaStreamSourceSampleRequest) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSourceSampleRequest> for ::windows::core::IInspectable { fn from(value: &MediaStreamSourceSampleRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSourceSampleRequest { 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 MediaStreamSourceSampleRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSourceSampleRequest {} unsafe impl ::core::marker::Sync for MediaStreamSourceSampleRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSourceSampleRequestDeferral(pub ::windows::core::IInspectable); impl MediaStreamSourceSampleRequestDeferral { pub fn Complete(&self) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this)).ok() } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceSampleRequestDeferral { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSourceSampleRequestDeferral;{7895cc02-f982-43c8-9d16-c62d999319be})"); } unsafe impl ::windows::core::Interface for MediaStreamSourceSampleRequestDeferral { type Vtable = IMediaStreamSourceSampleRequestDeferral_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7895cc02_f982_43c8_9d16_c62d999319be); } impl ::windows::core::RuntimeName for MediaStreamSourceSampleRequestDeferral { const NAME: &'static str = "Windows.Media.Core.MediaStreamSourceSampleRequestDeferral"; } impl ::core::convert::From<MediaStreamSourceSampleRequestDeferral> for ::windows::core::IUnknown { fn from(value: MediaStreamSourceSampleRequestDeferral) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSourceSampleRequestDeferral> for ::windows::core::IUnknown { fn from(value: &MediaStreamSourceSampleRequestDeferral) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSourceSampleRequestDeferral { 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 MediaStreamSourceSampleRequestDeferral { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSourceSampleRequestDeferral> for ::windows::core::IInspectable { fn from(value: MediaStreamSourceSampleRequestDeferral) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSourceSampleRequestDeferral> for ::windows::core::IInspectable { fn from(value: &MediaStreamSourceSampleRequestDeferral) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSourceSampleRequestDeferral { 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 MediaStreamSourceSampleRequestDeferral { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSourceSampleRequestDeferral {} unsafe impl ::core::marker::Sync for MediaStreamSourceSampleRequestDeferral {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSourceSampleRequestedEventArgs(pub ::windows::core::IInspectable); impl MediaStreamSourceSampleRequestedEventArgs { pub fn Request(&self) -> ::windows::core::Result<MediaStreamSourceSampleRequest> { 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::<MediaStreamSourceSampleRequest>(result__) } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceSampleRequestedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSourceSampleRequestedEventArgs;{10f9bb9e-71c5-492f-847f-0da1f35e81f8})"); } unsafe impl ::windows::core::Interface for MediaStreamSourceSampleRequestedEventArgs { type Vtable = IMediaStreamSourceSampleRequestedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x10f9bb9e_71c5_492f_847f_0da1f35e81f8); } impl ::windows::core::RuntimeName for MediaStreamSourceSampleRequestedEventArgs { const NAME: &'static str = "Windows.Media.Core.MediaStreamSourceSampleRequestedEventArgs"; } impl ::core::convert::From<MediaStreamSourceSampleRequestedEventArgs> for ::windows::core::IUnknown { fn from(value: MediaStreamSourceSampleRequestedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSourceSampleRequestedEventArgs> for ::windows::core::IUnknown { fn from(value: &MediaStreamSourceSampleRequestedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSourceSampleRequestedEventArgs { 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 MediaStreamSourceSampleRequestedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSourceSampleRequestedEventArgs> for ::windows::core::IInspectable { fn from(value: MediaStreamSourceSampleRequestedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSourceSampleRequestedEventArgs> for ::windows::core::IInspectable { fn from(value: &MediaStreamSourceSampleRequestedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSourceSampleRequestedEventArgs { 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 MediaStreamSourceSampleRequestedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSourceSampleRequestedEventArgs {} unsafe impl ::core::marker::Sync for MediaStreamSourceSampleRequestedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSourceStartingEventArgs(pub ::windows::core::IInspectable); impl MediaStreamSourceStartingEventArgs { pub fn Request(&self) -> ::windows::core::Result<MediaStreamSourceStartingRequest> { 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::<MediaStreamSourceStartingRequest>(result__) } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceStartingEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSourceStartingEventArgs;{f41468f2-c274-4940-a5bb-28a572452fa7})"); } unsafe impl ::windows::core::Interface for MediaStreamSourceStartingEventArgs { type Vtable = IMediaStreamSourceStartingEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xf41468f2_c274_4940_a5bb_28a572452fa7); } impl ::windows::core::RuntimeName for MediaStreamSourceStartingEventArgs { const NAME: &'static str = "Windows.Media.Core.MediaStreamSourceStartingEventArgs"; } impl ::core::convert::From<MediaStreamSourceStartingEventArgs> for ::windows::core::IUnknown { fn from(value: MediaStreamSourceStartingEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSourceStartingEventArgs> for ::windows::core::IUnknown { fn from(value: &MediaStreamSourceStartingEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSourceStartingEventArgs { 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 MediaStreamSourceStartingEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSourceStartingEventArgs> for ::windows::core::IInspectable { fn from(value: MediaStreamSourceStartingEventArgs) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSourceStartingEventArgs> for ::windows::core::IInspectable { fn from(value: &MediaStreamSourceStartingEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSourceStartingEventArgs { 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 MediaStreamSourceStartingEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSourceStartingEventArgs {} unsafe impl ::core::marker::Sync for MediaStreamSourceStartingEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSourceStartingRequest(pub ::windows::core::IInspectable); impl MediaStreamSourceStartingRequest { #[cfg(feature = "Foundation")] pub fn StartPosition(&self) -> ::windows::core::Result<super::super::Foundation::IReference<super::super::Foundation::TimeSpan>> { 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::<super::super::Foundation::IReference<super::super::Foundation::TimeSpan>>(result__) } } pub fn GetDeferral(&self) -> ::windows::core::Result<MediaStreamSourceStartingRequestDeferral> { 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::<MediaStreamSourceStartingRequestDeferral>(result__) } } #[cfg(feature = "Foundation")] pub fn SetActualStartPosition<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, position: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), position.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceStartingRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSourceStartingRequest;{2a9093e4-35c4-4b1b-a791-0d99db56dd1d})"); } unsafe impl ::windows::core::Interface for MediaStreamSourceStartingRequest { type Vtable = IMediaStreamSourceStartingRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x2a9093e4_35c4_4b1b_a791_0d99db56dd1d); } impl ::windows::core::RuntimeName for MediaStreamSourceStartingRequest { const NAME: &'static str = "Windows.Media.Core.MediaStreamSourceStartingRequest"; } impl ::core::convert::From<MediaStreamSourceStartingRequest> for ::windows::core::IUnknown { fn from(value: MediaStreamSourceStartingRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSourceStartingRequest> for ::windows::core::IUnknown { fn from(value: &MediaStreamSourceStartingRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSourceStartingRequest { 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 MediaStreamSourceStartingRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSourceStartingRequest> for ::windows::core::IInspectable { fn from(value: MediaStreamSourceStartingRequest) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSourceStartingRequest> for ::windows::core::IInspectable { fn from(value: &MediaStreamSourceStartingRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSourceStartingRequest { 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 MediaStreamSourceStartingRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSourceStartingRequest {} unsafe impl ::core::marker::Sync for MediaStreamSourceStartingRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSourceStartingRequestDeferral(pub ::windows::core::IInspectable); impl MediaStreamSourceStartingRequestDeferral { pub fn Complete(&self) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this)).ok() } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceStartingRequestDeferral { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSourceStartingRequestDeferral;{3f1356a5-6340-4dc4-9910-068ed9f598f8})"); } unsafe impl ::windows::core::Interface for MediaStreamSourceStartingRequestDeferral { type Vtable = IMediaStreamSourceStartingRequestDeferral_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x3f1356a5_6340_4dc4_9910_068ed9f598f8); } impl ::windows::core::RuntimeName for MediaStreamSourceStartingRequestDeferral { const NAME: &'static str = "Windows.Media.Core.MediaStreamSourceStartingRequestDeferral"; } impl ::core::convert::From<MediaStreamSourceStartingRequestDeferral> for ::windows::core::IUnknown { fn from(value: MediaStreamSourceStartingRequestDeferral) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSourceStartingRequestDeferral> for ::windows::core::IUnknown { fn from(value: &MediaStreamSourceStartingRequestDeferral) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSourceStartingRequestDeferral { 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 MediaStreamSourceStartingRequestDeferral { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSourceStartingRequestDeferral> for ::windows::core::IInspectable { fn from(value: MediaStreamSourceStartingRequestDeferral) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSourceStartingRequestDeferral> for ::windows::core::IInspectable { fn from(value: &MediaStreamSourceStartingRequestDeferral) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSourceStartingRequestDeferral { 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 MediaStreamSourceStartingRequestDeferral { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSourceStartingRequestDeferral {} unsafe impl ::core::marker::Sync for MediaStreamSourceStartingRequestDeferral {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSourceSwitchStreamsRequest(pub ::windows::core::IInspectable); impl MediaStreamSourceSwitchStreamsRequest { pub fn OldStreamDescriptor(&self) -> ::windows::core::Result<IMediaStreamDescriptor> { 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::<IMediaStreamDescriptor>(result__) } } pub fn NewStreamDescriptor(&self) -> ::windows::core::Result<IMediaStreamDescriptor> { 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::<IMediaStreamDescriptor>(result__) } } pub fn GetDeferral(&self) -> ::windows::core::Result<MediaStreamSourceSwitchStreamsRequestDeferral> { 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::<MediaStreamSourceSwitchStreamsRequestDeferral>(result__) } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceSwitchStreamsRequest { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSourceSwitchStreamsRequest;{41b8808e-38a9-4ec3-9ba0-b69b85501e90})"); } unsafe impl ::windows::core::Interface for MediaStreamSourceSwitchStreamsRequest { type Vtable = IMediaStreamSourceSwitchStreamsRequest_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x41b8808e_38a9_4ec3_9ba0_b69b85501e90); } impl ::windows::core::RuntimeName for MediaStreamSourceSwitchStreamsRequest { const NAME: &'static str = "Windows.Media.Core.MediaStreamSourceSwitchStreamsRequest"; } impl ::core::convert::From<MediaStreamSourceSwitchStreamsRequest> for ::windows::core::IUnknown { fn from(value: MediaStreamSourceSwitchStreamsRequest) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSourceSwitchStreamsRequest> for ::windows::core::IUnknown { fn from(value: &MediaStreamSourceSwitchStreamsRequest) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSourceSwitchStreamsRequest { 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 MediaStreamSourceSwitchStreamsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSourceSwitchStreamsRequest> for ::windows::core::IInspectable { fn from(value: MediaStreamSourceSwitchStreamsRequest) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSourceSwitchStreamsRequest> for ::windows::core::IInspectable { fn from(value: &MediaStreamSourceSwitchStreamsRequest) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSourceSwitchStreamsRequest { 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 MediaStreamSourceSwitchStreamsRequest { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSourceSwitchStreamsRequest {} unsafe impl ::core::marker::Sync for MediaStreamSourceSwitchStreamsRequest {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSourceSwitchStreamsRequestDeferral(pub ::windows::core::IInspectable); impl MediaStreamSourceSwitchStreamsRequestDeferral { pub fn Complete(&self) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this)).ok() } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceSwitchStreamsRequestDeferral { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSourceSwitchStreamsRequestDeferral;{bee3d835-a505-4f9a-b943-2b8cb1b4bbd9})"); } unsafe impl ::windows::core::Interface for MediaStreamSourceSwitchStreamsRequestDeferral { type Vtable = IMediaStreamSourceSwitchStreamsRequestDeferral_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xbee3d835_a505_4f9a_b943_2b8cb1b4bbd9); } impl ::windows::core::RuntimeName for MediaStreamSourceSwitchStreamsRequestDeferral { const NAME: &'static str = "Windows.Media.Core.MediaStreamSourceSwitchStreamsRequestDeferral"; } impl ::core::convert::From<MediaStreamSourceSwitchStreamsRequestDeferral> for ::windows::core::IUnknown { fn from(value: MediaStreamSourceSwitchStreamsRequestDeferral) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSourceSwitchStreamsRequestDeferral> for ::windows::core::IUnknown { fn from(value: &MediaStreamSourceSwitchStreamsRequestDeferral) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSourceSwitchStreamsRequestDeferral { 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 MediaStreamSourceSwitchStreamsRequestDeferral { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSourceSwitchStreamsRequestDeferral> for ::windows::core::IInspectable { fn from(value: MediaStreamSourceSwitchStreamsRequestDeferral) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSourceSwitchStreamsRequestDeferral> for ::windows::core::IInspectable { fn from(value: &MediaStreamSourceSwitchStreamsRequestDeferral) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSourceSwitchStreamsRequestDeferral { 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 MediaStreamSourceSwitchStreamsRequestDeferral { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSourceSwitchStreamsRequestDeferral {} unsafe impl ::core::marker::Sync for MediaStreamSourceSwitchStreamsRequestDeferral {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MediaStreamSourceSwitchStreamsRequestedEventArgs(pub ::windows::core::IInspectable); impl MediaStreamSourceSwitchStreamsRequestedEventArgs { pub fn Request(&self) -> ::windows::core::Result<MediaStreamSourceSwitchStreamsRequest> { 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::<MediaStreamSourceSwitchStreamsRequest>(result__) } } } unsafe impl ::windows::core::RuntimeType for MediaStreamSourceSwitchStreamsRequestedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MediaStreamSourceSwitchStreamsRequestedEventArgs;{42202b72-6ea1-4677-981e-350a0da412aa})"); } unsafe impl ::windows::core::Interface for MediaStreamSourceSwitchStreamsRequestedEventArgs { type Vtable = IMediaStreamSourceSwitchStreamsRequestedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x42202b72_6ea1_4677_981e_350a0da412aa); } impl ::windows::core::RuntimeName for MediaStreamSourceSwitchStreamsRequestedEventArgs { const NAME: &'static str = "Windows.Media.Core.MediaStreamSourceSwitchStreamsRequestedEventArgs"; } impl ::core::convert::From<MediaStreamSourceSwitchStreamsRequestedEventArgs> for ::windows::core::IUnknown { fn from(value: MediaStreamSourceSwitchStreamsRequestedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&MediaStreamSourceSwitchStreamsRequestedEventArgs> for ::windows::core::IUnknown { fn from(value: &MediaStreamSourceSwitchStreamsRequestedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MediaStreamSourceSwitchStreamsRequestedEventArgs { 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 MediaStreamSourceSwitchStreamsRequestedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MediaStreamSourceSwitchStreamsRequestedEventArgs> for ::windows::core::IInspectable { fn from(value: MediaStreamSourceSwitchStreamsRequestedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&MediaStreamSourceSwitchStreamsRequestedEventArgs> for ::windows::core::IInspectable { fn from(value: &MediaStreamSourceSwitchStreamsRequestedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MediaStreamSourceSwitchStreamsRequestedEventArgs { 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 MediaStreamSourceSwitchStreamsRequestedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MediaStreamSourceSwitchStreamsRequestedEventArgs {} unsafe impl ::core::marker::Sync for MediaStreamSourceSwitchStreamsRequestedEventArgs {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct MediaTrackKind(pub i32); impl MediaTrackKind { pub const Audio: MediaTrackKind = MediaTrackKind(0i32); pub const Video: MediaTrackKind = MediaTrackKind(1i32); pub const TimedMetadata: MediaTrackKind = MediaTrackKind(2i32); } impl ::core::convert::From<i32> for MediaTrackKind { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for MediaTrackKind { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for MediaTrackKind { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.MediaTrackKind;i4)"); } impl ::windows::core::DefaultType for MediaTrackKind { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct MseAppendMode(pub i32); impl MseAppendMode { pub const Segments: MseAppendMode = MseAppendMode(0i32); pub const Sequence: MseAppendMode = MseAppendMode(1i32); } impl ::core::convert::From<i32> for MseAppendMode { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for MseAppendMode { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for MseAppendMode { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.MseAppendMode;i4)"); } impl ::windows::core::DefaultType for MseAppendMode { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct MseEndOfStreamStatus(pub i32); impl MseEndOfStreamStatus { pub const Success: MseEndOfStreamStatus = MseEndOfStreamStatus(0i32); pub const NetworkError: MseEndOfStreamStatus = MseEndOfStreamStatus(1i32); pub const DecodeError: MseEndOfStreamStatus = MseEndOfStreamStatus(2i32); pub const UnknownError: MseEndOfStreamStatus = MseEndOfStreamStatus(3i32); } impl ::core::convert::From<i32> for MseEndOfStreamStatus { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for MseEndOfStreamStatus { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for MseEndOfStreamStatus { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.MseEndOfStreamStatus;i4)"); } impl ::windows::core::DefaultType for MseEndOfStreamStatus { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct MseReadyState(pub i32); impl MseReadyState { pub const Closed: MseReadyState = MseReadyState(0i32); pub const Open: MseReadyState = MseReadyState(1i32); pub const Ended: MseReadyState = MseReadyState(2i32); } impl ::core::convert::From<i32> for MseReadyState { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for MseReadyState { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for MseReadyState { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.MseReadyState;i4)"); } impl ::windows::core::DefaultType for MseReadyState { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MseSourceBuffer(pub ::windows::core::IInspectable); impl MseSourceBuffer { #[cfg(feature = "Foundation")] pub fn UpdateStarting<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MseSourceBuffer, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveUpdateStarting<'a, Param0: ::windows::core::IntoParam<'a, 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 Updated<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MseSourceBuffer, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveUpdated<'a, Param0: ::windows::core::IntoParam<'a, 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 UpdateEnded<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MseSourceBuffer, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveUpdateEnded<'a, Param0: ::windows::core::IntoParam<'a, 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 ErrorOccurred<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MseSourceBuffer, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveErrorOccurred<'a, Param0: ::windows::core::IntoParam<'a, 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 Aborted<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MseSourceBuffer, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveAborted<'a, Param0: ::windows::core::IntoParam<'a, 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() } } pub fn Mode(&self) -> ::windows::core::Result<MseAppendMode> { let this = self; unsafe { let mut result__: MseAppendMode = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MseAppendMode>(result__) } } pub fn SetMode(&self, value: MseAppendMode) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), value).ok() } } pub fn IsUpdating(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } #[cfg(all(feature = "Foundation", feature = "Foundation_Collections"))] pub fn Buffered(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<MseTimeRange>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).19)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IVectorView<MseTimeRange>>(result__) } } #[cfg(feature = "Foundation")] pub fn TimestampOffset(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).20)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn SetTimestampOffset<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).21)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn AppendWindowStart(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).22)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn SetAppendWindowStart<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).23)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn AppendWindowEnd(&self) -> ::windows::core::Result<super::super::Foundation::IReference<super::super::Foundation::TimeSpan>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).24)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IReference<super::super::Foundation::TimeSpan>>(result__) } } #[cfg(feature = "Foundation")] pub fn SetAppendWindowEnd<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<super::super::Foundation::TimeSpan>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).25)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Storage_Streams")] pub fn AppendBuffer<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IBuffer>>(&self, buffer: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).26)(::core::mem::transmute_copy(this), buffer.into_param().abi()).ok() } } #[cfg(feature = "Storage_Streams")] pub fn AppendStream<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IInputStream>>(&self, stream: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).27)(::core::mem::transmute_copy(this), stream.into_param().abi()).ok() } } #[cfg(feature = "Storage_Streams")] pub fn AppendStreamMaxSize<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IInputStream>>(&self, stream: Param0, maxsize: u64) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).28)(::core::mem::transmute_copy(this), stream.into_param().abi(), maxsize).ok() } } pub fn Abort(&self) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).29)(::core::mem::transmute_copy(this)).ok() } } #[cfg(feature = "Foundation")] pub fn Remove<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<super::super::Foundation::TimeSpan>>>(&self, start: Param0, end: Param1) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).30)(::core::mem::transmute_copy(this), start.into_param().abi(), end.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for MseSourceBuffer { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MseSourceBuffer;{0c1aa3e3-df8d-4079-a3fe-6849184b4e2f})"); } unsafe impl ::windows::core::Interface for MseSourceBuffer { type Vtable = IMseSourceBuffer_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0c1aa3e3_df8d_4079_a3fe_6849184b4e2f); } impl ::windows::core::RuntimeName for MseSourceBuffer { const NAME: &'static str = "Windows.Media.Core.MseSourceBuffer"; } impl ::core::convert::From<MseSourceBuffer> for ::windows::core::IUnknown { fn from(value: MseSourceBuffer) -> Self { value.0 .0 } } impl ::core::convert::From<&MseSourceBuffer> for ::windows::core::IUnknown { fn from(value: &MseSourceBuffer) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MseSourceBuffer { 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 MseSourceBuffer { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MseSourceBuffer> for ::windows::core::IInspectable { fn from(value: MseSourceBuffer) -> Self { value.0 } } impl ::core::convert::From<&MseSourceBuffer> for ::windows::core::IInspectable { fn from(value: &MseSourceBuffer) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MseSourceBuffer { 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 MseSourceBuffer { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MseSourceBuffer {} unsafe impl ::core::marker::Sync for MseSourceBuffer {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MseSourceBufferList(pub ::windows::core::IInspectable); impl MseSourceBufferList { #[cfg(feature = "Foundation")] pub fn SourceBufferAdded<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MseSourceBufferList, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveSourceBufferAdded<'a, Param0: ::windows::core::IntoParam<'a, 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 SourceBufferRemoved<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MseSourceBufferList, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveSourceBufferRemoved<'a, Param0: ::windows::core::IntoParam<'a, 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_Collections")] pub fn Buffers(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<MseSourceBuffer>> { 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::Foundation::Collections::IVectorView<MseSourceBuffer>>(result__) } } } unsafe impl ::windows::core::RuntimeType for MseSourceBufferList { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MseSourceBufferList;{95fae8e7-a8e7-4ebf-8927-145e940ba511})"); } unsafe impl ::windows::core::Interface for MseSourceBufferList { type Vtable = IMseSourceBufferList_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x95fae8e7_a8e7_4ebf_8927_145e940ba511); } impl ::windows::core::RuntimeName for MseSourceBufferList { const NAME: &'static str = "Windows.Media.Core.MseSourceBufferList"; } impl ::core::convert::From<MseSourceBufferList> for ::windows::core::IUnknown { fn from(value: MseSourceBufferList) -> Self { value.0 .0 } } impl ::core::convert::From<&MseSourceBufferList> for ::windows::core::IUnknown { fn from(value: &MseSourceBufferList) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MseSourceBufferList { 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 MseSourceBufferList { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MseSourceBufferList> for ::windows::core::IInspectable { fn from(value: MseSourceBufferList) -> Self { value.0 } } impl ::core::convert::From<&MseSourceBufferList> for ::windows::core::IInspectable { fn from(value: &MseSourceBufferList) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MseSourceBufferList { 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 MseSourceBufferList { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for MseSourceBufferList {} unsafe impl ::core::marker::Sync for MseSourceBufferList {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct MseStreamSource(pub ::windows::core::IInspectable); impl MseStreamSource { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MseStreamSource, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation")] pub fn Opened<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MseStreamSource, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveOpened<'a, Param0: ::windows::core::IntoParam<'a, 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 Ended<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MseStreamSource, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveEnded<'a, Param0: ::windows::core::IntoParam<'a, 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 Closed<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<MseStreamSource, ::windows::core::IInspectable>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveClosed<'a, Param0: ::windows::core::IntoParam<'a, 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() } } pub fn SourceBuffers(&self) -> ::windows::core::Result<MseSourceBufferList> { 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::<MseSourceBufferList>(result__) } } pub fn ActiveSourceBuffers(&self) -> ::windows::core::Result<MseSourceBufferList> { 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::<MseSourceBufferList>(result__) } } pub fn ReadyState(&self) -> ::windows::core::Result<MseReadyState> { let this = self; unsafe { let mut result__: MseReadyState = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MseReadyState>(result__) } } #[cfg(feature = "Foundation")] pub fn Duration(&self) -> ::windows::core::Result<super::super::Foundation::IReference<super::super::Foundation::TimeSpan>> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::IReference<super::super::Foundation::TimeSpan>>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDuration<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<super::super::Foundation::TimeSpan>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn AddSourceBuffer<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, mimetype: Param0) -> ::windows::core::Result<MseSourceBuffer> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), mimetype.into_param().abi(), &mut result__).from_abi::<MseSourceBuffer>(result__) } } pub fn RemoveSourceBuffer<'a, Param0: ::windows::core::IntoParam<'a, MseSourceBuffer>>(&self, buffer: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), buffer.into_param().abi()).ok() } } pub fn EndOfStream(&self, status: MseEndOfStreamStatus) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).19)(::core::mem::transmute_copy(this), status).ok() } } pub fn IsContentTypeSupported<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(contenttype: Param0) -> ::windows::core::Result<bool> { Self::IMseStreamSourceStatics(|this| unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), contenttype.into_param().abi(), &mut result__).from_abi::<bool>(result__) }) } #[cfg(feature = "Foundation")] pub fn LiveSeekableRange(&self) -> ::windows::core::Result<super::super::Foundation::IReference<MseTimeRange>> { let this = &::windows::core::Interface::cast::<IMseStreamSource2>(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::<super::super::Foundation::IReference<MseTimeRange>>(result__) } } #[cfg(feature = "Foundation")] pub fn SetLiveSeekableRange<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<MseTimeRange>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMseStreamSource2>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn IMseStreamSourceStatics<R, F: FnOnce(&IMseStreamSourceStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<MseStreamSource, IMseStreamSourceStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for MseStreamSource { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.MseStreamSource;{b0b4198d-02f4-4923-88dd-81bc3f360ffa})"); } unsafe impl ::windows::core::Interface for MseStreamSource { type Vtable = IMseStreamSource_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb0b4198d_02f4_4923_88dd_81bc3f360ffa); } impl ::windows::core::RuntimeName for MseStreamSource { const NAME: &'static str = "Windows.Media.Core.MseStreamSource"; } impl ::core::convert::From<MseStreamSource> for ::windows::core::IUnknown { fn from(value: MseStreamSource) -> Self { value.0 .0 } } impl ::core::convert::From<&MseStreamSource> for ::windows::core::IUnknown { fn from(value: &MseStreamSource) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for MseStreamSource { 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 MseStreamSource { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<MseStreamSource> for ::windows::core::IInspectable { fn from(value: MseStreamSource) -> Self { value.0 } } impl ::core::convert::From<&MseStreamSource> for ::windows::core::IInspectable { fn from(value: &MseStreamSource) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for MseStreamSource { 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 MseStreamSource { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<MseStreamSource> for IMediaSource { type Error = ::windows::core::Error; fn try_from(value: MseStreamSource) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&MseStreamSource> for IMediaSource { type Error = ::windows::core::Error; fn try_from(value: &MseStreamSource) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaSource> for MseStreamSource { fn into_param(self) -> ::windows::core::Param<'a, IMediaSource> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaSource> for &MseStreamSource { fn into_param(self) -> ::windows::core::Param<'a, IMediaSource> { ::core::convert::TryInto::<IMediaSource>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for MseStreamSource {} unsafe impl ::core::marker::Sync for MseStreamSource {} #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Foundation")] pub struct MseTimeRange { pub Start: super::super::Foundation::TimeSpan, pub End: super::super::Foundation::TimeSpan, } #[cfg(feature = "Foundation")] impl MseTimeRange {} #[cfg(feature = "Foundation")] impl ::core::default::Default for MseTimeRange { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } #[cfg(feature = "Foundation")] impl ::core::fmt::Debug for MseTimeRange { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("MseTimeRange").field("Start", &self.Start).field("End", &self.End).finish() } } #[cfg(feature = "Foundation")] impl ::core::cmp::PartialEq for MseTimeRange { fn eq(&self, other: &Self) -> bool { self.Start == other.Start && self.End == other.End } } #[cfg(feature = "Foundation")] impl ::core::cmp::Eq for MseTimeRange {} #[cfg(feature = "Foundation")] unsafe impl ::windows::core::Abi for MseTimeRange { type Abi = Self; } #[cfg(feature = "Foundation")] unsafe impl ::windows::core::RuntimeType for MseTimeRange { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"struct(Windows.Media.Core.MseTimeRange;struct(Windows.Foundation.TimeSpan;i8);struct(Windows.Foundation.TimeSpan;i8))"); } #[cfg(feature = "Foundation")] impl ::windows::core::DefaultType for MseTimeRange { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SceneAnalysisEffect(pub ::windows::core::IInspectable); impl SceneAnalysisEffect { pub fn HighDynamicRangeAnalyzer(&self) -> ::windows::core::Result<HighDynamicRangeControl> { 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::<HighDynamicRangeControl>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDesiredAnalysisInterval<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn DesiredAnalysisInterval(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = self; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn SceneAnalyzed<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<SceneAnalysisEffect, SceneAnalyzedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: super::super::Foundation::EventRegistrationToken = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), handler.into_param().abi(), &mut result__).from_abi::<super::super::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveSceneAnalyzed<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn SetProperties<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IPropertySet>>(&self, configuration: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::IMediaExtension>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), configuration.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for SceneAnalysisEffect { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.SceneAnalysisEffect;{c04ba319-ca41-4813-bffd-7b08b0ed2557})"); } unsafe impl ::windows::core::Interface for SceneAnalysisEffect { type Vtable = ISceneAnalysisEffect_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc04ba319_ca41_4813_bffd_7b08b0ed2557); } impl ::windows::core::RuntimeName for SceneAnalysisEffect { const NAME: &'static str = "Windows.Media.Core.SceneAnalysisEffect"; } impl ::core::convert::From<SceneAnalysisEffect> for ::windows::core::IUnknown { fn from(value: SceneAnalysisEffect) -> Self { value.0 .0 } } impl ::core::convert::From<&SceneAnalysisEffect> for ::windows::core::IUnknown { fn from(value: &SceneAnalysisEffect) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SceneAnalysisEffect { 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 SceneAnalysisEffect { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SceneAnalysisEffect> for ::windows::core::IInspectable { fn from(value: SceneAnalysisEffect) -> Self { value.0 } } impl ::core::convert::From<&SceneAnalysisEffect> for ::windows::core::IInspectable { fn from(value: &SceneAnalysisEffect) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SceneAnalysisEffect { 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 SceneAnalysisEffect { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SceneAnalysisEffect> for super::IMediaExtension { type Error = ::windows::core::Error; fn try_from(value: SceneAnalysisEffect) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SceneAnalysisEffect> for super::IMediaExtension { type Error = ::windows::core::Error; fn try_from(value: &SceneAnalysisEffect) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, super::IMediaExtension> for SceneAnalysisEffect { fn into_param(self) -> ::windows::core::Param<'a, super::IMediaExtension> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, super::IMediaExtension> for &SceneAnalysisEffect { fn into_param(self) -> ::windows::core::Param<'a, super::IMediaExtension> { ::core::convert::TryInto::<super::IMediaExtension>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for SceneAnalysisEffect {} unsafe impl ::core::marker::Sync for SceneAnalysisEffect {} #[cfg(feature = "Media_Effects")] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SceneAnalysisEffectDefinition(pub ::windows::core::IInspectable); #[cfg(feature = "Media_Effects")] impl SceneAnalysisEffectDefinition { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SceneAnalysisEffectDefinition, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Media_Effects")] pub fn ActivatableClassId(&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 = "Media_Effects"))] pub fn Properties(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IPropertySet> { 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::Foundation::Collections::IPropertySet>(result__) } } } #[cfg(feature = "Media_Effects")] unsafe impl ::windows::core::RuntimeType for SceneAnalysisEffectDefinition { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.SceneAnalysisEffectDefinition;{39f38cf0-8d0f-4f3e-84fc-2d46a5297943})"); } #[cfg(feature = "Media_Effects")] unsafe impl ::windows::core::Interface for SceneAnalysisEffectDefinition { type Vtable = super::Effects::IVideoEffectDefinition_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x39f38cf0_8d0f_4f3e_84fc_2d46a5297943); } #[cfg(feature = "Media_Effects")] impl ::windows::core::RuntimeName for SceneAnalysisEffectDefinition { const NAME: &'static str = "Windows.Media.Core.SceneAnalysisEffectDefinition"; } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<SceneAnalysisEffectDefinition> for ::windows::core::IUnknown { fn from(value: SceneAnalysisEffectDefinition) -> Self { value.0 .0 } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<&SceneAnalysisEffectDefinition> for ::windows::core::IUnknown { fn from(value: &SceneAnalysisEffectDefinition) -> Self { value.0 .0.clone() } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SceneAnalysisEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a SceneAnalysisEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<SceneAnalysisEffectDefinition> for ::windows::core::IInspectable { fn from(value: SceneAnalysisEffectDefinition) -> Self { value.0 } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<&SceneAnalysisEffectDefinition> for ::windows::core::IInspectable { fn from(value: &SceneAnalysisEffectDefinition) -> Self { value.0.clone() } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SceneAnalysisEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a SceneAnalysisEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<SceneAnalysisEffectDefinition> for super::Effects::IVideoEffectDefinition { fn from(value: SceneAnalysisEffectDefinition) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<&SceneAnalysisEffectDefinition> for super::Effects::IVideoEffectDefinition { fn from(value: &SceneAnalysisEffectDefinition) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, super::Effects::IVideoEffectDefinition> for SceneAnalysisEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, super::Effects::IVideoEffectDefinition> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, super::Effects::IVideoEffectDefinition> for &SceneAnalysisEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, super::Effects::IVideoEffectDefinition> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Media_Effects")] unsafe impl ::core::marker::Send for SceneAnalysisEffectDefinition {} #[cfg(feature = "Media_Effects")] unsafe impl ::core::marker::Sync for SceneAnalysisEffectDefinition {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SceneAnalysisEffectFrame(pub ::windows::core::IInspectable); impl SceneAnalysisEffectFrame { #[cfg(feature = "Media_Capture")] pub fn FrameControlValues(&self) -> ::windows::core::Result<super::Capture::CapturedFrameControlValues> { 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::<super::Capture::CapturedFrameControlValues>(result__) } } pub fn HighDynamicRange(&self) -> ::windows::core::Result<HighDynamicRangeOutput> { 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::<HighDynamicRangeOutput>(result__) } } #[cfg(feature = "Foundation")] pub fn Close(&self) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::super::Foundation::IClosable>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this)).ok() } } pub fn Type(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(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 IsReadOnly(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } #[cfg(feature = "Foundation")] pub fn SetRelativeTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<super::super::Foundation::TimeSpan>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn RelativeTime(&self) -> ::windows::core::Result<super::super::Foundation::IReference<super::super::Foundation::TimeSpan>> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(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::Foundation::IReference<super::super::Foundation::TimeSpan>>(result__) } } #[cfg(feature = "Foundation")] pub fn SetSystemRelativeTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<super::super::Foundation::TimeSpan>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn SystemRelativeTime(&self) -> ::windows::core::Result<super::super::Foundation::IReference<super::super::Foundation::TimeSpan>> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(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::Foundation::IReference<super::super::Foundation::TimeSpan>>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDuration<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<super::super::Foundation::TimeSpan>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Duration(&self) -> ::windows::core::Result<super::super::Foundation::IReference<super::super::Foundation::TimeSpan>> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(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::Foundation::IReference<super::super::Foundation::TimeSpan>>(result__) } } pub fn SetIsDiscontinuous(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), value).ok() } } pub fn IsDiscontinuous(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ExtendedProperties(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IPropertySet> { let this = &::windows::core::Interface::cast::<super::IMediaFrame>(self)?; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::Collections::IPropertySet>(result__) } } pub fn AnalysisRecommendation(&self) -> ::windows::core::Result<SceneAnalysisRecommendation> { let this = &::windows::core::Interface::cast::<ISceneAnalysisEffectFrame2>(self)?; unsafe { let mut result__: SceneAnalysisRecommendation = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<SceneAnalysisRecommendation>(result__) } } } unsafe impl ::windows::core::RuntimeType for SceneAnalysisEffectFrame { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.SceneAnalysisEffectFrame;{d8b10e4c-7fd9-42e1-85eb-6572c297c987})"); } unsafe impl ::windows::core::Interface for SceneAnalysisEffectFrame { type Vtable = ISceneAnalysisEffectFrame_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd8b10e4c_7fd9_42e1_85eb_6572c297c987); } impl ::windows::core::RuntimeName for SceneAnalysisEffectFrame { const NAME: &'static str = "Windows.Media.Core.SceneAnalysisEffectFrame"; } impl ::core::convert::From<SceneAnalysisEffectFrame> for ::windows::core::IUnknown { fn from(value: SceneAnalysisEffectFrame) -> Self { value.0 .0 } } impl ::core::convert::From<&SceneAnalysisEffectFrame> for ::windows::core::IUnknown { fn from(value: &SceneAnalysisEffectFrame) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SceneAnalysisEffectFrame { 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 SceneAnalysisEffectFrame { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SceneAnalysisEffectFrame> for ::windows::core::IInspectable { fn from(value: SceneAnalysisEffectFrame) -> Self { value.0 } } impl ::core::convert::From<&SceneAnalysisEffectFrame> for ::windows::core::IInspectable { fn from(value: &SceneAnalysisEffectFrame) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SceneAnalysisEffectFrame { 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 SceneAnalysisEffectFrame { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<SceneAnalysisEffectFrame> for super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: SceneAnalysisEffectFrame) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } #[cfg(feature = "Foundation")] impl ::core::convert::TryFrom<&SceneAnalysisEffectFrame> for super::super::Foundation::IClosable { type Error = ::windows::core::Error; fn try_from(value: &SceneAnalysisEffectFrame) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::IClosable> for SceneAnalysisEffectFrame { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::IClosable> { ::windows::core::IntoParam::into_param(&self) } } #[cfg(feature = "Foundation")] impl<'a> ::windows::core::IntoParam<'a, super::super::Foundation::IClosable> for &SceneAnalysisEffectFrame { fn into_param(self) -> ::windows::core::Param<'a, super::super::Foundation::IClosable> { ::core::convert::TryInto::<super::super::Foundation::IClosable>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } impl ::core::convert::TryFrom<SceneAnalysisEffectFrame> for super::IMediaFrame { type Error = ::windows::core::Error; fn try_from(value: SceneAnalysisEffectFrame) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SceneAnalysisEffectFrame> for super::IMediaFrame { type Error = ::windows::core::Error; fn try_from(value: &SceneAnalysisEffectFrame) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, super::IMediaFrame> for SceneAnalysisEffectFrame { fn into_param(self) -> ::windows::core::Param<'a, super::IMediaFrame> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, super::IMediaFrame> for &SceneAnalysisEffectFrame { fn into_param(self) -> ::windows::core::Param<'a, super::IMediaFrame> { ::core::convert::TryInto::<super::IMediaFrame>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for SceneAnalysisEffectFrame {} unsafe impl ::core::marker::Sync for SceneAnalysisEffectFrame {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct SceneAnalysisRecommendation(pub i32); impl SceneAnalysisRecommendation { pub const Standard: SceneAnalysisRecommendation = SceneAnalysisRecommendation(0i32); pub const Hdr: SceneAnalysisRecommendation = SceneAnalysisRecommendation(1i32); pub const LowLight: SceneAnalysisRecommendation = SceneAnalysisRecommendation(2i32); } impl ::core::convert::From<i32> for SceneAnalysisRecommendation { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for SceneAnalysisRecommendation { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for SceneAnalysisRecommendation { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.SceneAnalysisRecommendation;i4)"); } impl ::windows::core::DefaultType for SceneAnalysisRecommendation { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SceneAnalyzedEventArgs(pub ::windows::core::IInspectable); impl SceneAnalyzedEventArgs { pub fn ResultFrame(&self) -> ::windows::core::Result<SceneAnalysisEffectFrame> { 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::<SceneAnalysisEffectFrame>(result__) } } } unsafe impl ::windows::core::RuntimeType for SceneAnalyzedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.SceneAnalyzedEventArgs;{146b9588-2851-45e4-ad55-44cf8df8db4d})"); } unsafe impl ::windows::core::Interface for SceneAnalyzedEventArgs { type Vtable = ISceneAnalyzedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x146b9588_2851_45e4_ad55_44cf8df8db4d); } impl ::windows::core::RuntimeName for SceneAnalyzedEventArgs { const NAME: &'static str = "Windows.Media.Core.SceneAnalyzedEventArgs"; } impl ::core::convert::From<SceneAnalyzedEventArgs> for ::windows::core::IUnknown { fn from(value: SceneAnalyzedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&SceneAnalyzedEventArgs> for ::windows::core::IUnknown { fn from(value: &SceneAnalyzedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SceneAnalyzedEventArgs { 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 SceneAnalyzedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SceneAnalyzedEventArgs> for ::windows::core::IInspectable { fn from(value: SceneAnalyzedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&SceneAnalyzedEventArgs> for ::windows::core::IInspectable { fn from(value: &SceneAnalyzedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SceneAnalyzedEventArgs { 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 SceneAnalyzedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for SceneAnalyzedEventArgs {} unsafe impl ::core::marker::Sync for SceneAnalyzedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct SpeechCue(pub ::windows::core::IInspectable); impl SpeechCue { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<SpeechCue, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Foundation")] pub fn SetStartTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn StartTime(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDuration<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Duration(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } pub fn SetId<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Id(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaCue>(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 Text(&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 SetText<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn StartPositionInInput(&self) -> ::windows::core::Result<super::super::Foundation::IReference<i32>> { 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::Foundation::IReference<i32>>(result__) } } #[cfg(feature = "Foundation")] pub fn SetStartPositionInInput<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<i32>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn EndPositionInInput(&self) -> ::windows::core::Result<super::super::Foundation::IReference<i32>> { 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::Foundation::IReference<i32>>(result__) } } #[cfg(feature = "Foundation")] pub fn SetEndPositionInInput<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::IReference<i32>>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for SpeechCue { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.SpeechCue;{aee254dc-1725-4bad-8043-a98499b017a2})"); } unsafe impl ::windows::core::Interface for SpeechCue { type Vtable = ISpeechCue_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xaee254dc_1725_4bad_8043_a98499b017a2); } impl ::windows::core::RuntimeName for SpeechCue { const NAME: &'static str = "Windows.Media.Core.SpeechCue"; } impl ::core::convert::From<SpeechCue> for ::windows::core::IUnknown { fn from(value: SpeechCue) -> Self { value.0 .0 } } impl ::core::convert::From<&SpeechCue> for ::windows::core::IUnknown { fn from(value: &SpeechCue) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for SpeechCue { 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 SpeechCue { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<SpeechCue> for ::windows::core::IInspectable { fn from(value: SpeechCue) -> Self { value.0 } } impl ::core::convert::From<&SpeechCue> for ::windows::core::IInspectable { fn from(value: &SpeechCue) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for SpeechCue { 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 SpeechCue { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<SpeechCue> for IMediaCue { type Error = ::windows::core::Error; fn try_from(value: SpeechCue) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&SpeechCue> for IMediaCue { type Error = ::windows::core::Error; fn try_from(value: &SpeechCue) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaCue> for SpeechCue { fn into_param(self) -> ::windows::core::Param<'a, IMediaCue> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaCue> for &SpeechCue { fn into_param(self) -> ::windows::core::Param<'a, IMediaCue> { ::core::convert::TryInto::<IMediaCue>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for SpeechCue {} unsafe impl ::core::marker::Sync for SpeechCue {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedMetadataKind(pub i32); impl TimedMetadataKind { pub const Caption: TimedMetadataKind = TimedMetadataKind(0i32); pub const Chapter: TimedMetadataKind = TimedMetadataKind(1i32); pub const Custom: TimedMetadataKind = TimedMetadataKind(2i32); pub const Data: TimedMetadataKind = TimedMetadataKind(3i32); pub const Description: TimedMetadataKind = TimedMetadataKind(4i32); pub const Subtitle: TimedMetadataKind = TimedMetadataKind(5i32); pub const ImageSubtitle: TimedMetadataKind = TimedMetadataKind(6i32); pub const Speech: TimedMetadataKind = TimedMetadataKind(7i32); } impl ::core::convert::From<i32> for TimedMetadataKind { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedMetadataKind { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedMetadataKind { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedMetadataKind;i4)"); } impl ::windows::core::DefaultType for TimedMetadataKind { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimedMetadataStreamDescriptor(pub ::windows::core::IInspectable); impl TimedMetadataStreamDescriptor { pub fn IsSelected(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } 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__) } } pub fn SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&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 SetLabel<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor2>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Label(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor2>(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 = "Media_MediaProperties")] pub fn EncodingProperties(&self) -> ::windows::core::Result<super::MediaProperties::TimedMetadataEncodingProperties> { let this = &::windows::core::Interface::cast::<ITimedMetadataStreamDescriptor>(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::<super::MediaProperties::TimedMetadataEncodingProperties>(result__) } } pub fn Copy(&self) -> ::windows::core::Result<TimedMetadataStreamDescriptor> { let this = &::windows::core::Interface::cast::<ITimedMetadataStreamDescriptor>(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::<TimedMetadataStreamDescriptor>(result__) } } #[cfg(feature = "Media_MediaProperties")] pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, super::MediaProperties::TimedMetadataEncodingProperties>>(encodingproperties: Param0) -> ::windows::core::Result<TimedMetadataStreamDescriptor> { Self::ITimedMetadataStreamDescriptorFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), encodingproperties.into_param().abi(), &mut result__).from_abi::<TimedMetadataStreamDescriptor>(result__) }) } pub fn ITimedMetadataStreamDescriptorFactory<R, F: FnOnce(&ITimedMetadataStreamDescriptorFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<TimedMetadataStreamDescriptor, ITimedMetadataStreamDescriptorFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for TimedMetadataStreamDescriptor { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.TimedMetadataStreamDescriptor;{80f16e6e-92f7-451e-97d2-afd80742da70})"); } unsafe impl ::windows::core::Interface for TimedMetadataStreamDescriptor { type Vtable = IMediaStreamDescriptor_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x80f16e6e_92f7_451e_97d2_afd80742da70); } impl ::windows::core::RuntimeName for TimedMetadataStreamDescriptor { const NAME: &'static str = "Windows.Media.Core.TimedMetadataStreamDescriptor"; } impl ::core::convert::From<TimedMetadataStreamDescriptor> for ::windows::core::IUnknown { fn from(value: TimedMetadataStreamDescriptor) -> Self { value.0 .0 } } impl ::core::convert::From<&TimedMetadataStreamDescriptor> for ::windows::core::IUnknown { fn from(value: &TimedMetadataStreamDescriptor) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimedMetadataStreamDescriptor { 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 TimedMetadataStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimedMetadataStreamDescriptor> for ::windows::core::IInspectable { fn from(value: TimedMetadataStreamDescriptor) -> Self { value.0 } } impl ::core::convert::From<&TimedMetadataStreamDescriptor> for ::windows::core::IInspectable { fn from(value: &TimedMetadataStreamDescriptor) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimedMetadataStreamDescriptor { 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 TimedMetadataStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<TimedMetadataStreamDescriptor> for IMediaStreamDescriptor { fn from(value: TimedMetadataStreamDescriptor) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&TimedMetadataStreamDescriptor> for IMediaStreamDescriptor { fn from(value: &TimedMetadataStreamDescriptor) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor> for TimedMetadataStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor> for &TimedMetadataStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } impl ::core::convert::TryFrom<TimedMetadataStreamDescriptor> for IMediaStreamDescriptor2 { type Error = ::windows::core::Error; fn try_from(value: TimedMetadataStreamDescriptor) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&TimedMetadataStreamDescriptor> for IMediaStreamDescriptor2 { type Error = ::windows::core::Error; fn try_from(value: &TimedMetadataStreamDescriptor) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor2> for TimedMetadataStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor2> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor2> for &TimedMetadataStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor2> { ::core::convert::TryInto::<IMediaStreamDescriptor2>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for TimedMetadataStreamDescriptor {} unsafe impl ::core::marker::Sync for TimedMetadataStreamDescriptor {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimedMetadataTrack(pub ::windows::core::IInspectable); impl TimedMetadataTrack { #[cfg(feature = "Foundation")] pub fn CueEntered<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<TimedMetadataTrack, MediaCueEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveCueEntered<'a, Param0: ::windows::core::IntoParam<'a, 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 CueExited<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<TimedMetadataTrack, MediaCueEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveCueExited<'a, Param0: ::windows::core::IntoParam<'a, 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 TrackFailed<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<TimedMetadataTrack, TimedMetadataTrackFailedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveTrackFailed<'a, Param0: ::windows::core::IntoParam<'a, 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_Collections")] pub fn Cues(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<IMediaCue>> { 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::Foundation::Collections::IVectorView<IMediaCue>>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn ActiveCues(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<IMediaCue>> { 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::Foundation::Collections::IVectorView<IMediaCue>>(result__) } } pub fn TimedMetadataKind(&self) -> ::windows::core::Result<TimedMetadataKind> { let this = self; unsafe { let mut result__: TimedMetadataKind = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedMetadataKind>(result__) } } pub fn DispatchType(&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).15)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn AddCue<'a, Param0: ::windows::core::IntoParam<'a, IMediaCue>>(&self, cue: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), cue.into_param().abi()).ok() } } pub fn RemoveCue<'a, Param0: ::windows::core::IntoParam<'a, IMediaCue>>(&self, cue: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), cue.into_param().abi()).ok() } } pub fn Id(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaTrack>(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 Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaTrack>(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 TrackKind(&self) -> ::windows::core::Result<MediaTrackKind> { let this = &::windows::core::Interface::cast::<IMediaTrack>(self)?; unsafe { let mut result__: MediaTrackKind = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MediaTrackKind>(result__) } } pub fn SetLabel<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaTrack>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Label(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaTrack>(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 Create<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(id: Param0, language: Param1, kind: TimedMetadataKind) -> ::windows::core::Result<TimedMetadataTrack> { Self::ITimedMetadataTrackFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), id.into_param().abi(), language.into_param().abi(), kind, &mut result__).from_abi::<TimedMetadataTrack>(result__) }) } #[cfg(feature = "Media_Playback")] pub fn PlaybackItem(&self) -> ::windows::core::Result<super::Playback::MediaPlaybackItem> { let this = &::windows::core::Interface::cast::<ITimedMetadataTrack2>(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::<super::Playback::MediaPlaybackItem>(result__) } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<ITimedMetadataTrack2>(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 ITimedMetadataTrackFactory<R, F: FnOnce(&ITimedMetadataTrackFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<TimedMetadataTrack, ITimedMetadataTrackFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for TimedMetadataTrack { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.TimedMetadataTrack;{9e6aed9e-f67a-49a9-b330-cf03b0e9cf07})"); } unsafe impl ::windows::core::Interface for TimedMetadataTrack { type Vtable = ITimedMetadataTrack_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x9e6aed9e_f67a_49a9_b330_cf03b0e9cf07); } impl ::windows::core::RuntimeName for TimedMetadataTrack { const NAME: &'static str = "Windows.Media.Core.TimedMetadataTrack"; } impl ::core::convert::From<TimedMetadataTrack> for ::windows::core::IUnknown { fn from(value: TimedMetadataTrack) -> Self { value.0 .0 } } impl ::core::convert::From<&TimedMetadataTrack> for ::windows::core::IUnknown { fn from(value: &TimedMetadataTrack) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimedMetadataTrack { 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 TimedMetadataTrack { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimedMetadataTrack> for ::windows::core::IInspectable { fn from(value: TimedMetadataTrack) -> Self { value.0 } } impl ::core::convert::From<&TimedMetadataTrack> for ::windows::core::IInspectable { fn from(value: &TimedMetadataTrack) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimedMetadataTrack { 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 TimedMetadataTrack { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<TimedMetadataTrack> for IMediaTrack { type Error = ::windows::core::Error; fn try_from(value: TimedMetadataTrack) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&TimedMetadataTrack> for IMediaTrack { type Error = ::windows::core::Error; fn try_from(value: &TimedMetadataTrack) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaTrack> for TimedMetadataTrack { fn into_param(self) -> ::windows::core::Param<'a, IMediaTrack> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaTrack> for &TimedMetadataTrack { fn into_param(self) -> ::windows::core::Param<'a, IMediaTrack> { ::core::convert::TryInto::<IMediaTrack>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for TimedMetadataTrack {} unsafe impl ::core::marker::Sync for TimedMetadataTrack {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimedMetadataTrackError(pub ::windows::core::IInspectable); impl TimedMetadataTrackError { pub fn ErrorCode(&self) -> ::windows::core::Result<TimedMetadataTrackErrorCode> { let this = self; unsafe { let mut result__: TimedMetadataTrackErrorCode = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedMetadataTrackErrorCode>(result__) } } pub fn ExtendedError(&self) -> ::windows::core::Result<::windows::core::HRESULT> { let this = self; unsafe { let mut result__: ::windows::core::HRESULT = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HRESULT>(result__) } } } unsafe impl ::windows::core::RuntimeType for TimedMetadataTrackError { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.TimedMetadataTrackError;{b3767915-4114-4819-b9d9-dd76089e72f8})"); } unsafe impl ::windows::core::Interface for TimedMetadataTrackError { type Vtable = ITimedMetadataTrackError_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xb3767915_4114_4819_b9d9_dd76089e72f8); } impl ::windows::core::RuntimeName for TimedMetadataTrackError { const NAME: &'static str = "Windows.Media.Core.TimedMetadataTrackError"; } impl ::core::convert::From<TimedMetadataTrackError> for ::windows::core::IUnknown { fn from(value: TimedMetadataTrackError) -> Self { value.0 .0 } } impl ::core::convert::From<&TimedMetadataTrackError> for ::windows::core::IUnknown { fn from(value: &TimedMetadataTrackError) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimedMetadataTrackError { 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 TimedMetadataTrackError { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimedMetadataTrackError> for ::windows::core::IInspectable { fn from(value: TimedMetadataTrackError) -> Self { value.0 } } impl ::core::convert::From<&TimedMetadataTrackError> for ::windows::core::IInspectable { fn from(value: &TimedMetadataTrackError) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimedMetadataTrackError { 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 TimedMetadataTrackError { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for TimedMetadataTrackError {} unsafe impl ::core::marker::Sync for TimedMetadataTrackError {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedMetadataTrackErrorCode(pub i32); impl TimedMetadataTrackErrorCode { pub const None: TimedMetadataTrackErrorCode = TimedMetadataTrackErrorCode(0i32); pub const DataFormatError: TimedMetadataTrackErrorCode = TimedMetadataTrackErrorCode(1i32); pub const NetworkError: TimedMetadataTrackErrorCode = TimedMetadataTrackErrorCode(2i32); pub const InternalError: TimedMetadataTrackErrorCode = TimedMetadataTrackErrorCode(3i32); } impl ::core::convert::From<i32> for TimedMetadataTrackErrorCode { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedMetadataTrackErrorCode { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedMetadataTrackErrorCode { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedMetadataTrackErrorCode;i4)"); } impl ::windows::core::DefaultType for TimedMetadataTrackErrorCode { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimedMetadataTrackFailedEventArgs(pub ::windows::core::IInspectable); impl TimedMetadataTrackFailedEventArgs { pub fn Error(&self) -> ::windows::core::Result<TimedMetadataTrackError> { 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::<TimedMetadataTrackError>(result__) } } } unsafe impl ::windows::core::RuntimeType for TimedMetadataTrackFailedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.TimedMetadataTrackFailedEventArgs;{a57fc9d1-6789-4d4d-b07f-84b4f31acb70})"); } unsafe impl ::windows::core::Interface for TimedMetadataTrackFailedEventArgs { type Vtable = ITimedMetadataTrackFailedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xa57fc9d1_6789_4d4d_b07f_84b4f31acb70); } impl ::windows::core::RuntimeName for TimedMetadataTrackFailedEventArgs { const NAME: &'static str = "Windows.Media.Core.TimedMetadataTrackFailedEventArgs"; } impl ::core::convert::From<TimedMetadataTrackFailedEventArgs> for ::windows::core::IUnknown { fn from(value: TimedMetadataTrackFailedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&TimedMetadataTrackFailedEventArgs> for ::windows::core::IUnknown { fn from(value: &TimedMetadataTrackFailedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimedMetadataTrackFailedEventArgs { 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 TimedMetadataTrackFailedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimedMetadataTrackFailedEventArgs> for ::windows::core::IInspectable { fn from(value: TimedMetadataTrackFailedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&TimedMetadataTrackFailedEventArgs> for ::windows::core::IInspectable { fn from(value: &TimedMetadataTrackFailedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimedMetadataTrackFailedEventArgs { 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 TimedMetadataTrackFailedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for TimedMetadataTrackFailedEventArgs {} unsafe impl ::core::marker::Sync for TimedMetadataTrackFailedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimedTextBouten(pub ::windows::core::IInspectable); impl TimedTextBouten { pub fn Type(&self) -> ::windows::core::Result<TimedTextBoutenType> { let this = self; unsafe { let mut result__: TimedTextBoutenType = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextBoutenType>(result__) } } pub fn SetType(&self, value: TimedTextBoutenType) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value).ok() } } #[cfg(feature = "UI")] pub fn Color(&self) -> ::windows::core::Result<super::super::UI::Color> { let this = self; unsafe { let mut result__: super::super::UI::Color = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::UI::Color>(result__) } } #[cfg(feature = "UI")] pub fn SetColor<'a, Param0: ::windows::core::IntoParam<'a, super::super::UI::Color>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Position(&self) -> ::windows::core::Result<TimedTextBoutenPosition> { let this = self; unsafe { let mut result__: TimedTextBoutenPosition = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextBoutenPosition>(result__) } } pub fn SetPosition(&self, value: TimedTextBoutenPosition) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value).ok() } } } unsafe impl ::windows::core::RuntimeType for TimedTextBouten { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.TimedTextBouten;{d9062783-5597-5092-820c-8f738e0f774a})"); } unsafe impl ::windows::core::Interface for TimedTextBouten { type Vtable = ITimedTextBouten_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd9062783_5597_5092_820c_8f738e0f774a); } impl ::windows::core::RuntimeName for TimedTextBouten { const NAME: &'static str = "Windows.Media.Core.TimedTextBouten"; } impl ::core::convert::From<TimedTextBouten> for ::windows::core::IUnknown { fn from(value: TimedTextBouten) -> Self { value.0 .0 } } impl ::core::convert::From<&TimedTextBouten> for ::windows::core::IUnknown { fn from(value: &TimedTextBouten) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimedTextBouten { 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 TimedTextBouten { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimedTextBouten> for ::windows::core::IInspectable { fn from(value: TimedTextBouten) -> Self { value.0 } } impl ::core::convert::From<&TimedTextBouten> for ::windows::core::IInspectable { fn from(value: &TimedTextBouten) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimedTextBouten { 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 TimedTextBouten { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for TimedTextBouten {} unsafe impl ::core::marker::Sync for TimedTextBouten {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextBoutenPosition(pub i32); impl TimedTextBoutenPosition { pub const Before: TimedTextBoutenPosition = TimedTextBoutenPosition(0i32); pub const After: TimedTextBoutenPosition = TimedTextBoutenPosition(1i32); pub const Outside: TimedTextBoutenPosition = TimedTextBoutenPosition(2i32); } impl ::core::convert::From<i32> for TimedTextBoutenPosition { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextBoutenPosition { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextBoutenPosition { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextBoutenPosition;i4)"); } impl ::windows::core::DefaultType for TimedTextBoutenPosition { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextBoutenType(pub i32); impl TimedTextBoutenType { pub const None: TimedTextBoutenType = TimedTextBoutenType(0i32); pub const Auto: TimedTextBoutenType = TimedTextBoutenType(1i32); pub const FilledCircle: TimedTextBoutenType = TimedTextBoutenType(2i32); pub const OpenCircle: TimedTextBoutenType = TimedTextBoutenType(3i32); pub const FilledDot: TimedTextBoutenType = TimedTextBoutenType(4i32); pub const OpenDot: TimedTextBoutenType = TimedTextBoutenType(5i32); pub const FilledSesame: TimedTextBoutenType = TimedTextBoutenType(6i32); pub const OpenSesame: TimedTextBoutenType = TimedTextBoutenType(7i32); } impl ::core::convert::From<i32> for TimedTextBoutenType { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextBoutenType { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextBoutenType { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextBoutenType;i4)"); } impl ::windows::core::DefaultType for TimedTextBoutenType { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimedTextCue(pub ::windows::core::IInspectable); impl TimedTextCue { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<TimedTextCue, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn CueRegion(&self) -> ::windows::core::Result<TimedTextRegion> { 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::<TimedTextRegion>(result__) } } pub fn SetCueRegion<'a, Param0: ::windows::core::IntoParam<'a, TimedTextRegion>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn CueStyle(&self) -> ::windows::core::Result<TimedTextStyle> { 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::<TimedTextStyle>(result__) } } pub fn SetCueStyle<'a, Param0: ::windows::core::IntoParam<'a, TimedTextStyle>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn Lines(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<TimedTextLine>> { 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::Foundation::Collections::IVector<TimedTextLine>>(result__) } } #[cfg(feature = "Foundation")] pub fn SetStartTime<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn StartTime(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } #[cfg(feature = "Foundation")] pub fn SetDuration<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TimeSpan>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation")] pub fn Duration(&self) -> ::windows::core::Result<super::super::Foundation::TimeSpan> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { let mut result__: super::super::Foundation::TimeSpan = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::Foundation::TimeSpan>(result__) } } pub fn SetId<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaCue>(self)?; unsafe { (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Id(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaCue>(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__) } } } unsafe impl ::windows::core::RuntimeType for TimedTextCue { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.TimedTextCue;{51c79e51-3b86-494d-b359-bb2ea7aca9a9})"); } unsafe impl ::windows::core::Interface for TimedTextCue { type Vtable = ITimedTextCue_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x51c79e51_3b86_494d_b359_bb2ea7aca9a9); } impl ::windows::core::RuntimeName for TimedTextCue { const NAME: &'static str = "Windows.Media.Core.TimedTextCue"; } impl ::core::convert::From<TimedTextCue> for ::windows::core::IUnknown { fn from(value: TimedTextCue) -> Self { value.0 .0 } } impl ::core::convert::From<&TimedTextCue> for ::windows::core::IUnknown { fn from(value: &TimedTextCue) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimedTextCue { 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 TimedTextCue { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimedTextCue> for ::windows::core::IInspectable { fn from(value: TimedTextCue) -> Self { value.0 } } impl ::core::convert::From<&TimedTextCue> for ::windows::core::IInspectable { fn from(value: &TimedTextCue) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimedTextCue { 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 TimedTextCue { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<TimedTextCue> for IMediaCue { type Error = ::windows::core::Error; fn try_from(value: TimedTextCue) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&TimedTextCue> for IMediaCue { type Error = ::windows::core::Error; fn try_from(value: &TimedTextCue) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaCue> for TimedTextCue { fn into_param(self) -> ::windows::core::Param<'a, IMediaCue> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaCue> for &TimedTextCue { fn into_param(self) -> ::windows::core::Param<'a, IMediaCue> { ::core::convert::TryInto::<IMediaCue>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for TimedTextCue {} unsafe impl ::core::marker::Sync for TimedTextCue {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextDisplayAlignment(pub i32); impl TimedTextDisplayAlignment { pub const Before: TimedTextDisplayAlignment = TimedTextDisplayAlignment(0i32); pub const After: TimedTextDisplayAlignment = TimedTextDisplayAlignment(1i32); pub const Center: TimedTextDisplayAlignment = TimedTextDisplayAlignment(2i32); } impl ::core::convert::From<i32> for TimedTextDisplayAlignment { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextDisplayAlignment { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextDisplayAlignment { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextDisplayAlignment;i4)"); } impl ::windows::core::DefaultType for TimedTextDisplayAlignment { type DefaultType = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct TimedTextDouble { pub Value: f64, pub Unit: TimedTextUnit, } impl TimedTextDouble {} impl ::core::default::Default for TimedTextDouble { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for TimedTextDouble { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TimedTextDouble").field("Value", &self.Value).field("Unit", &self.Unit).finish() } } impl ::core::cmp::PartialEq for TimedTextDouble { fn eq(&self, other: &Self) -> bool { self.Value == other.Value && self.Unit == other.Unit } } impl ::core::cmp::Eq for TimedTextDouble {} unsafe impl ::windows::core::Abi for TimedTextDouble { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextDouble { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"struct(Windows.Media.Core.TimedTextDouble;f8;enum(Windows.Media.Core.TimedTextUnit;i4))"); } impl ::windows::core::DefaultType for TimedTextDouble { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextFlowDirection(pub i32); impl TimedTextFlowDirection { pub const LeftToRight: TimedTextFlowDirection = TimedTextFlowDirection(0i32); pub const RightToLeft: TimedTextFlowDirection = TimedTextFlowDirection(1i32); } impl ::core::convert::From<i32> for TimedTextFlowDirection { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextFlowDirection { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextFlowDirection { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextFlowDirection;i4)"); } impl ::windows::core::DefaultType for TimedTextFlowDirection { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextFontStyle(pub i32); impl TimedTextFontStyle { pub const Normal: TimedTextFontStyle = TimedTextFontStyle(0i32); pub const Oblique: TimedTextFontStyle = TimedTextFontStyle(1i32); pub const Italic: TimedTextFontStyle = TimedTextFontStyle(2i32); } impl ::core::convert::From<i32> for TimedTextFontStyle { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextFontStyle { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextFontStyle { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextFontStyle;i4)"); } impl ::windows::core::DefaultType for TimedTextFontStyle { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimedTextLine(pub ::windows::core::IInspectable); impl TimedTextLine { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<TimedTextLine, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn Text(&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 SetText<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "Foundation_Collections")] pub fn Subformats(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVector<TimedTextSubformat>> { 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::Foundation::Collections::IVector<TimedTextSubformat>>(result__) } } } unsafe impl ::windows::core::RuntimeType for TimedTextLine { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.TimedTextLine;{978d7ce2-7308-4c66-be50-65777289f5df})"); } unsafe impl ::windows::core::Interface for TimedTextLine { type Vtable = ITimedTextLine_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x978d7ce2_7308_4c66_be50_65777289f5df); } impl ::windows::core::RuntimeName for TimedTextLine { const NAME: &'static str = "Windows.Media.Core.TimedTextLine"; } impl ::core::convert::From<TimedTextLine> for ::windows::core::IUnknown { fn from(value: TimedTextLine) -> Self { value.0 .0 } } impl ::core::convert::From<&TimedTextLine> for ::windows::core::IUnknown { fn from(value: &TimedTextLine) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimedTextLine { 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 TimedTextLine { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimedTextLine> for ::windows::core::IInspectable { fn from(value: TimedTextLine) -> Self { value.0 } } impl ::core::convert::From<&TimedTextLine> for ::windows::core::IInspectable { fn from(value: &TimedTextLine) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimedTextLine { 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 TimedTextLine { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for TimedTextLine {} unsafe impl ::core::marker::Sync for TimedTextLine {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextLineAlignment(pub i32); impl TimedTextLineAlignment { pub const Start: TimedTextLineAlignment = TimedTextLineAlignment(0i32); pub const End: TimedTextLineAlignment = TimedTextLineAlignment(1i32); pub const Center: TimedTextLineAlignment = TimedTextLineAlignment(2i32); } impl ::core::convert::From<i32> for TimedTextLineAlignment { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextLineAlignment { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextLineAlignment { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextLineAlignment;i4)"); } impl ::windows::core::DefaultType for TimedTextLineAlignment { type DefaultType = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct TimedTextPadding { pub Before: f64, pub After: f64, pub Start: f64, pub End: f64, pub Unit: TimedTextUnit, } impl TimedTextPadding {} impl ::core::default::Default for TimedTextPadding { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for TimedTextPadding { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TimedTextPadding").field("Before", &self.Before).field("After", &self.After).field("Start", &self.Start).field("End", &self.End).field("Unit", &self.Unit).finish() } } impl ::core::cmp::PartialEq for TimedTextPadding { fn eq(&self, other: &Self) -> bool { self.Before == other.Before && self.After == other.After && self.Start == other.Start && self.End == other.End && self.Unit == other.Unit } } impl ::core::cmp::Eq for TimedTextPadding {} unsafe impl ::windows::core::Abi for TimedTextPadding { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextPadding { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"struct(Windows.Media.Core.TimedTextPadding;f8;f8;f8;f8;enum(Windows.Media.Core.TimedTextUnit;i4))"); } impl ::windows::core::DefaultType for TimedTextPadding { type DefaultType = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct TimedTextPoint { pub X: f64, pub Y: f64, pub Unit: TimedTextUnit, } impl TimedTextPoint {} impl ::core::default::Default for TimedTextPoint { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for TimedTextPoint { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TimedTextPoint").field("X", &self.X).field("Y", &self.Y).field("Unit", &self.Unit).finish() } } impl ::core::cmp::PartialEq for TimedTextPoint { fn eq(&self, other: &Self) -> bool { self.X == other.X && self.Y == other.Y && self.Unit == other.Unit } } impl ::core::cmp::Eq for TimedTextPoint {} unsafe impl ::windows::core::Abi for TimedTextPoint { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextPoint { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"struct(Windows.Media.Core.TimedTextPoint;f8;f8;enum(Windows.Media.Core.TimedTextUnit;i4))"); } impl ::windows::core::DefaultType for TimedTextPoint { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimedTextRegion(pub ::windows::core::IInspectable); impl TimedTextRegion { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<TimedTextRegion, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } 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).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Position(&self) -> ::windows::core::Result<TimedTextPoint> { let this = self; unsafe { let mut result__: TimedTextPoint = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextPoint>(result__) } } pub fn SetPosition<'a, Param0: ::windows::core::IntoParam<'a, TimedTextPoint>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Extent(&self) -> ::windows::core::Result<TimedTextSize> { let this = self; unsafe { let mut result__: TimedTextSize = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextSize>(result__) } } pub fn SetExtent<'a, Param0: ::windows::core::IntoParam<'a, TimedTextSize>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "UI")] pub fn Background(&self) -> ::windows::core::Result<super::super::UI::Color> { let this = self; unsafe { let mut result__: super::super::UI::Color = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::UI::Color>(result__) } } #[cfg(feature = "UI")] pub fn SetBackground<'a, Param0: ::windows::core::IntoParam<'a, super::super::UI::Color>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn WritingMode(&self) -> ::windows::core::Result<TimedTextWritingMode> { let this = self; unsafe { let mut result__: TimedTextWritingMode = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextWritingMode>(result__) } } pub fn SetWritingMode(&self, value: TimedTextWritingMode) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value).ok() } } pub fn DisplayAlignment(&self) -> ::windows::core::Result<TimedTextDisplayAlignment> { let this = self; unsafe { let mut result__: TimedTextDisplayAlignment = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextDisplayAlignment>(result__) } } pub fn SetDisplayAlignment(&self, value: TimedTextDisplayAlignment) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), value).ok() } } pub fn LineHeight(&self) -> ::windows::core::Result<TimedTextDouble> { let this = self; unsafe { let mut result__: TimedTextDouble = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextDouble>(result__) } } pub fn SetLineHeight<'a, Param0: ::windows::core::IntoParam<'a, TimedTextDouble>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).19)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn IsOverflowClipped(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).20)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetIsOverflowClipped(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).21)(::core::mem::transmute_copy(this), value).ok() } } pub fn Padding(&self) -> ::windows::core::Result<TimedTextPadding> { let this = self; unsafe { let mut result__: TimedTextPadding = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).22)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextPadding>(result__) } } pub fn SetPadding<'a, Param0: ::windows::core::IntoParam<'a, TimedTextPadding>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).23)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn TextWrapping(&self) -> ::windows::core::Result<TimedTextWrapping> { let this = self; unsafe { let mut result__: TimedTextWrapping = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).24)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextWrapping>(result__) } } pub fn SetTextWrapping(&self, value: TimedTextWrapping) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).25)(::core::mem::transmute_copy(this), value).ok() } } pub fn ZIndex(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).26)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } pub fn SetZIndex(&self, value: i32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).27)(::core::mem::transmute_copy(this), value).ok() } } pub fn ScrollMode(&self) -> ::windows::core::Result<TimedTextScrollMode> { let this = self; unsafe { let mut result__: TimedTextScrollMode = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).28)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextScrollMode>(result__) } } pub fn SetScrollMode(&self, value: TimedTextScrollMode) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).29)(::core::mem::transmute_copy(this), value).ok() } } } unsafe impl ::windows::core::RuntimeType for TimedTextRegion { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.TimedTextRegion;{1ed0881f-8a06-4222-9f59-b21bf40124b4})"); } unsafe impl ::windows::core::Interface for TimedTextRegion { type Vtable = ITimedTextRegion_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1ed0881f_8a06_4222_9f59_b21bf40124b4); } impl ::windows::core::RuntimeName for TimedTextRegion { const NAME: &'static str = "Windows.Media.Core.TimedTextRegion"; } impl ::core::convert::From<TimedTextRegion> for ::windows::core::IUnknown { fn from(value: TimedTextRegion) -> Self { value.0 .0 } } impl ::core::convert::From<&TimedTextRegion> for ::windows::core::IUnknown { fn from(value: &TimedTextRegion) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimedTextRegion { 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 TimedTextRegion { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimedTextRegion> for ::windows::core::IInspectable { fn from(value: TimedTextRegion) -> Self { value.0 } } impl ::core::convert::From<&TimedTextRegion> for ::windows::core::IInspectable { fn from(value: &TimedTextRegion) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimedTextRegion { 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 TimedTextRegion { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for TimedTextRegion {} unsafe impl ::core::marker::Sync for TimedTextRegion {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimedTextRuby(pub ::windows::core::IInspectable); impl TimedTextRuby { pub fn Text(&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 SetText<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Position(&self) -> ::windows::core::Result<TimedTextRubyPosition> { let this = self; unsafe { let mut result__: TimedTextRubyPosition = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextRubyPosition>(result__) } } pub fn SetPosition(&self, value: TimedTextRubyPosition) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value).ok() } } pub fn Align(&self) -> ::windows::core::Result<TimedTextRubyAlign> { let this = self; unsafe { let mut result__: TimedTextRubyAlign = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextRubyAlign>(result__) } } pub fn SetAlign(&self, value: TimedTextRubyAlign) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value).ok() } } pub fn Reserve(&self) -> ::windows::core::Result<TimedTextRubyReserve> { let this = self; unsafe { let mut result__: TimedTextRubyReserve = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextRubyReserve>(result__) } } pub fn SetReserve(&self, value: TimedTextRubyReserve) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value).ok() } } } unsafe impl ::windows::core::RuntimeType for TimedTextRuby { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.TimedTextRuby;{10335c29-5b3c-5693-9959-d05a0bd24628})"); } unsafe impl ::windows::core::Interface for TimedTextRuby { type Vtable = ITimedTextRuby_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x10335c29_5b3c_5693_9959_d05a0bd24628); } impl ::windows::core::RuntimeName for TimedTextRuby { const NAME: &'static str = "Windows.Media.Core.TimedTextRuby"; } impl ::core::convert::From<TimedTextRuby> for ::windows::core::IUnknown { fn from(value: TimedTextRuby) -> Self { value.0 .0 } } impl ::core::convert::From<&TimedTextRuby> for ::windows::core::IUnknown { fn from(value: &TimedTextRuby) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimedTextRuby { 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 TimedTextRuby { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimedTextRuby> for ::windows::core::IInspectable { fn from(value: TimedTextRuby) -> Self { value.0 } } impl ::core::convert::From<&TimedTextRuby> for ::windows::core::IInspectable { fn from(value: &TimedTextRuby) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimedTextRuby { 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 TimedTextRuby { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for TimedTextRuby {} unsafe impl ::core::marker::Sync for TimedTextRuby {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextRubyAlign(pub i32); impl TimedTextRubyAlign { pub const Center: TimedTextRubyAlign = TimedTextRubyAlign(0i32); pub const Start: TimedTextRubyAlign = TimedTextRubyAlign(1i32); pub const End: TimedTextRubyAlign = TimedTextRubyAlign(2i32); pub const SpaceAround: TimedTextRubyAlign = TimedTextRubyAlign(3i32); pub const SpaceBetween: TimedTextRubyAlign = TimedTextRubyAlign(4i32); pub const WithBase: TimedTextRubyAlign = TimedTextRubyAlign(5i32); } impl ::core::convert::From<i32> for TimedTextRubyAlign { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextRubyAlign { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextRubyAlign { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextRubyAlign;i4)"); } impl ::windows::core::DefaultType for TimedTextRubyAlign { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextRubyPosition(pub i32); impl TimedTextRubyPosition { pub const Before: TimedTextRubyPosition = TimedTextRubyPosition(0i32); pub const After: TimedTextRubyPosition = TimedTextRubyPosition(1i32); pub const Outside: TimedTextRubyPosition = TimedTextRubyPosition(2i32); } impl ::core::convert::From<i32> for TimedTextRubyPosition { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextRubyPosition { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextRubyPosition { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextRubyPosition;i4)"); } impl ::windows::core::DefaultType for TimedTextRubyPosition { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextRubyReserve(pub i32); impl TimedTextRubyReserve { pub const None: TimedTextRubyReserve = TimedTextRubyReserve(0i32); pub const Before: TimedTextRubyReserve = TimedTextRubyReserve(1i32); pub const After: TimedTextRubyReserve = TimedTextRubyReserve(2i32); pub const Both: TimedTextRubyReserve = TimedTextRubyReserve(3i32); pub const Outside: TimedTextRubyReserve = TimedTextRubyReserve(4i32); } impl ::core::convert::From<i32> for TimedTextRubyReserve { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextRubyReserve { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextRubyReserve { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextRubyReserve;i4)"); } impl ::windows::core::DefaultType for TimedTextRubyReserve { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextScrollMode(pub i32); impl TimedTextScrollMode { pub const Popon: TimedTextScrollMode = TimedTextScrollMode(0i32); pub const Rollup: TimedTextScrollMode = TimedTextScrollMode(1i32); } impl ::core::convert::From<i32> for TimedTextScrollMode { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextScrollMode { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextScrollMode { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextScrollMode;i4)"); } impl ::windows::core::DefaultType for TimedTextScrollMode { type DefaultType = Self; } #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] pub struct TimedTextSize { pub Height: f64, pub Width: f64, pub Unit: TimedTextUnit, } impl TimedTextSize {} impl ::core::default::Default for TimedTextSize { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } impl ::core::fmt::Debug for TimedTextSize { fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { fmt.debug_struct("TimedTextSize").field("Height", &self.Height).field("Width", &self.Width).field("Unit", &self.Unit).finish() } } impl ::core::cmp::PartialEq for TimedTextSize { fn eq(&self, other: &Self) -> bool { self.Height == other.Height && self.Width == other.Width && self.Unit == other.Unit } } impl ::core::cmp::Eq for TimedTextSize {} unsafe impl ::windows::core::Abi for TimedTextSize { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextSize { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"struct(Windows.Media.Core.TimedTextSize;f8;f8;enum(Windows.Media.Core.TimedTextUnit;i4))"); } impl ::windows::core::DefaultType for TimedTextSize { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimedTextSource(pub ::windows::core::IInspectable); impl TimedTextSource { #[cfg(feature = "Foundation")] pub fn Resolved<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<TimedTextSource, TimedTextSourceResolveResultEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveResolved<'a, Param0: ::windows::core::IntoParam<'a, 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 = "Storage_Streams")] pub fn CreateFromStream<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStream>>(stream: Param0) -> ::windows::core::Result<TimedTextSource> { Self::ITimedTextSourceStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), stream.into_param().abi(), &mut result__).from_abi::<TimedTextSource>(result__) }) } #[cfg(feature = "Foundation")] pub fn CreateFromUri<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(uri: Param0) -> ::windows::core::Result<TimedTextSource> { Self::ITimedTextSourceStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), uri.into_param().abi(), &mut result__).from_abi::<TimedTextSource>(result__) }) } #[cfg(feature = "Storage_Streams")] pub fn CreateFromStreamWithLanguage<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStream>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(stream: Param0, defaultlanguage: Param1) -> ::windows::core::Result<TimedTextSource> { Self::ITimedTextSourceStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), stream.into_param().abi(), defaultlanguage.into_param().abi(), &mut result__).from_abi::<TimedTextSource>(result__) }) } #[cfg(feature = "Foundation")] pub fn CreateFromUriWithLanguage<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>, Param1: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(uri: Param0, defaultlanguage: Param1) -> ::windows::core::Result<TimedTextSource> { Self::ITimedTextSourceStatics(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), uri.into_param().abi(), defaultlanguage.into_param().abi(), &mut result__).from_abi::<TimedTextSource>(result__) }) } #[cfg(feature = "Storage_Streams")] pub fn CreateFromStreamWithIndex<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStream>, Param1: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStream>>(stream: Param0, indexstream: Param1) -> ::windows::core::Result<TimedTextSource> { Self::ITimedTextSourceStatics2(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), stream.into_param().abi(), indexstream.into_param().abi(), &mut result__).from_abi::<TimedTextSource>(result__) }) } #[cfg(feature = "Foundation")] pub fn CreateFromUriWithIndex<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>>(uri: Param0, indexuri: Param1) -> ::windows::core::Result<TimedTextSource> { Self::ITimedTextSourceStatics2(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), uri.into_param().abi(), indexuri.into_param().abi(), &mut result__).from_abi::<TimedTextSource>(result__) }) } #[cfg(feature = "Storage_Streams")] pub fn CreateFromStreamWithIndexAndLanguage<'a, Param0: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStream>, Param1: ::windows::core::IntoParam<'a, super::super::Storage::Streams::IRandomAccessStream>, Param2: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(stream: Param0, indexstream: Param1, defaultlanguage: Param2) -> ::windows::core::Result<TimedTextSource> { Self::ITimedTextSourceStatics2(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), stream.into_param().abi(), indexstream.into_param().abi(), defaultlanguage.into_param().abi(), &mut result__).from_abi::<TimedTextSource>(result__) }) } #[cfg(feature = "Foundation")] pub fn CreateFromUriWithIndexAndLanguage<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>, Param1: ::windows::core::IntoParam<'a, super::super::Foundation::Uri>, Param2: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(uri: Param0, indexuri: Param1, defaultlanguage: Param2) -> ::windows::core::Result<TimedTextSource> { Self::ITimedTextSourceStatics2(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), uri.into_param().abi(), indexuri.into_param().abi(), defaultlanguage.into_param().abi(), &mut result__).from_abi::<TimedTextSource>(result__) }) } pub fn ITimedTextSourceStatics<R, F: FnOnce(&ITimedTextSourceStatics) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<TimedTextSource, ITimedTextSourceStatics> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn ITimedTextSourceStatics2<R, F: FnOnce(&ITimedTextSourceStatics2) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<TimedTextSource, ITimedTextSourceStatics2> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for TimedTextSource { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.TimedTextSource;{c4ed9ba6-101f-404d-a949-82f33fcd93b7})"); } unsafe impl ::windows::core::Interface for TimedTextSource { type Vtable = ITimedTextSource_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xc4ed9ba6_101f_404d_a949_82f33fcd93b7); } impl ::windows::core::RuntimeName for TimedTextSource { const NAME: &'static str = "Windows.Media.Core.TimedTextSource"; } impl ::core::convert::From<TimedTextSource> for ::windows::core::IUnknown { fn from(value: TimedTextSource) -> Self { value.0 .0 } } impl ::core::convert::From<&TimedTextSource> for ::windows::core::IUnknown { fn from(value: &TimedTextSource) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimedTextSource { 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 TimedTextSource { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimedTextSource> for ::windows::core::IInspectable { fn from(value: TimedTextSource) -> Self { value.0 } } impl ::core::convert::From<&TimedTextSource> for ::windows::core::IInspectable { fn from(value: &TimedTextSource) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimedTextSource { 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 TimedTextSource { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for TimedTextSource {} unsafe impl ::core::marker::Sync for TimedTextSource {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimedTextSourceResolveResultEventArgs(pub ::windows::core::IInspectable); impl TimedTextSourceResolveResultEventArgs { pub fn Error(&self) -> ::windows::core::Result<TimedMetadataTrackError> { 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::<TimedMetadataTrackError>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn Tracks(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IVectorView<TimedMetadataTrack>> { 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::Foundation::Collections::IVectorView<TimedMetadataTrack>>(result__) } } } unsafe impl ::windows::core::RuntimeType for TimedTextSourceResolveResultEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.TimedTextSourceResolveResultEventArgs;{48907c9c-dcd8-4c33-9ad3-6cdce7b1c566})"); } unsafe impl ::windows::core::Interface for TimedTextSourceResolveResultEventArgs { type Vtable = ITimedTextSourceResolveResultEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x48907c9c_dcd8_4c33_9ad3_6cdce7b1c566); } impl ::windows::core::RuntimeName for TimedTextSourceResolveResultEventArgs { const NAME: &'static str = "Windows.Media.Core.TimedTextSourceResolveResultEventArgs"; } impl ::core::convert::From<TimedTextSourceResolveResultEventArgs> for ::windows::core::IUnknown { fn from(value: TimedTextSourceResolveResultEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&TimedTextSourceResolveResultEventArgs> for ::windows::core::IUnknown { fn from(value: &TimedTextSourceResolveResultEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimedTextSourceResolveResultEventArgs { 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 TimedTextSourceResolveResultEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimedTextSourceResolveResultEventArgs> for ::windows::core::IInspectable { fn from(value: TimedTextSourceResolveResultEventArgs) -> Self { value.0 } } impl ::core::convert::From<&TimedTextSourceResolveResultEventArgs> for ::windows::core::IInspectable { fn from(value: &TimedTextSourceResolveResultEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimedTextSourceResolveResultEventArgs { 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 TimedTextSourceResolveResultEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for TimedTextSourceResolveResultEventArgs {} unsafe impl ::core::marker::Sync for TimedTextSourceResolveResultEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimedTextStyle(pub ::windows::core::IInspectable); impl TimedTextStyle { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<TimedTextStyle, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } 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).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HSTRING>(result__) } } pub fn SetName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn FontFamily(&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 SetFontFamily<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn FontSize(&self) -> ::windows::core::Result<TimedTextDouble> { let this = self; unsafe { let mut result__: TimedTextDouble = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextDouble>(result__) } } pub fn SetFontSize<'a, Param0: ::windows::core::IntoParam<'a, TimedTextDouble>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn FontWeight(&self) -> ::windows::core::Result<TimedTextWeight> { let this = self; unsafe { let mut result__: TimedTextWeight = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextWeight>(result__) } } pub fn SetFontWeight(&self, value: TimedTextWeight) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value).ok() } } #[cfg(feature = "UI")] pub fn Foreground(&self) -> ::windows::core::Result<super::super::UI::Color> { let this = self; unsafe { let mut result__: super::super::UI::Color = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).14)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::UI::Color>(result__) } } #[cfg(feature = "UI")] pub fn SetForeground<'a, Param0: ::windows::core::IntoParam<'a, super::super::UI::Color>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).15)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } #[cfg(feature = "UI")] pub fn Background(&self) -> ::windows::core::Result<super::super::UI::Color> { let this = self; unsafe { let mut result__: super::super::UI::Color = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).16)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::UI::Color>(result__) } } #[cfg(feature = "UI")] pub fn SetBackground<'a, Param0: ::windows::core::IntoParam<'a, super::super::UI::Color>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).17)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn IsBackgroundAlwaysShown(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).18)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetIsBackgroundAlwaysShown(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).19)(::core::mem::transmute_copy(this), value).ok() } } pub fn FlowDirection(&self) -> ::windows::core::Result<TimedTextFlowDirection> { let this = self; unsafe { let mut result__: TimedTextFlowDirection = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).20)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextFlowDirection>(result__) } } pub fn SetFlowDirection(&self, value: TimedTextFlowDirection) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).21)(::core::mem::transmute_copy(this), value).ok() } } pub fn LineAlignment(&self) -> ::windows::core::Result<TimedTextLineAlignment> { let this = self; unsafe { let mut result__: TimedTextLineAlignment = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).22)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextLineAlignment>(result__) } } pub fn SetLineAlignment(&self, value: TimedTextLineAlignment) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).23)(::core::mem::transmute_copy(this), value).ok() } } #[cfg(feature = "UI")] pub fn OutlineColor(&self) -> ::windows::core::Result<super::super::UI::Color> { let this = self; unsafe { let mut result__: super::super::UI::Color = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).24)(::core::mem::transmute_copy(this), &mut result__).from_abi::<super::super::UI::Color>(result__) } } #[cfg(feature = "UI")] pub fn SetOutlineColor<'a, Param0: ::windows::core::IntoParam<'a, super::super::UI::Color>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).25)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn OutlineThickness(&self) -> ::windows::core::Result<TimedTextDouble> { let this = self; unsafe { let mut result__: TimedTextDouble = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).26)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextDouble>(result__) } } pub fn SetOutlineThickness<'a, Param0: ::windows::core::IntoParam<'a, TimedTextDouble>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).27)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn OutlineRadius(&self) -> ::windows::core::Result<TimedTextDouble> { let this = self; unsafe { let mut result__: TimedTextDouble = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).28)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextDouble>(result__) } } pub fn SetOutlineRadius<'a, Param0: ::windows::core::IntoParam<'a, TimedTextDouble>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).29)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn FontStyle(&self) -> ::windows::core::Result<TimedTextFontStyle> { let this = &::windows::core::Interface::cast::<ITimedTextStyle2>(self)?; unsafe { let mut result__: TimedTextFontStyle = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<TimedTextFontStyle>(result__) } } pub fn SetFontStyle(&self, value: TimedTextFontStyle) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ITimedTextStyle2>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value).ok() } } pub fn IsUnderlineEnabled(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<ITimedTextStyle2>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetIsUnderlineEnabled(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ITimedTextStyle2>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value).ok() } } pub fn IsLineThroughEnabled(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<ITimedTextStyle2>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetIsLineThroughEnabled(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ITimedTextStyle2>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value).ok() } } pub fn IsOverlineEnabled(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<ITimedTextStyle2>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).12)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetIsOverlineEnabled(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ITimedTextStyle2>(self)?; unsafe { (::windows::core::Interface::vtable(this).13)(::core::mem::transmute_copy(this), value).ok() } } pub fn Ruby(&self) -> ::windows::core::Result<TimedTextRuby> { let this = &::windows::core::Interface::cast::<ITimedTextStyle3>(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::<TimedTextRuby>(result__) } } pub fn Bouten(&self) -> ::windows::core::Result<TimedTextBouten> { let this = &::windows::core::Interface::cast::<ITimedTextStyle3>(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::<TimedTextBouten>(result__) } } pub fn IsTextCombined(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<ITimedTextStyle3>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetIsTextCombined(&self, value: bool) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ITimedTextStyle3>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value).ok() } } pub fn FontAngleInDegrees(&self) -> ::windows::core::Result<f64> { let this = &::windows::core::Interface::cast::<ITimedTextStyle3>(self)?; unsafe { let mut result__: f64 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), &mut result__).from_abi::<f64>(result__) } } pub fn SetFontAngleInDegrees(&self, value: f64) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<ITimedTextStyle3>(self)?; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value).ok() } } } unsafe impl ::windows::core::RuntimeType for TimedTextStyle { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.TimedTextStyle;{1bb2384d-a825-40c2-a7f5-281eaedf3b55})"); } unsafe impl ::windows::core::Interface for TimedTextStyle { type Vtable = ITimedTextStyle_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x1bb2384d_a825_40c2_a7f5_281eaedf3b55); } impl ::windows::core::RuntimeName for TimedTextStyle { const NAME: &'static str = "Windows.Media.Core.TimedTextStyle"; } impl ::core::convert::From<TimedTextStyle> for ::windows::core::IUnknown { fn from(value: TimedTextStyle) -> Self { value.0 .0 } } impl ::core::convert::From<&TimedTextStyle> for ::windows::core::IUnknown { fn from(value: &TimedTextStyle) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimedTextStyle { 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 TimedTextStyle { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimedTextStyle> for ::windows::core::IInspectable { fn from(value: TimedTextStyle) -> Self { value.0 } } impl ::core::convert::From<&TimedTextStyle> for ::windows::core::IInspectable { fn from(value: &TimedTextStyle) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimedTextStyle { 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 TimedTextStyle { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for TimedTextStyle {} unsafe impl ::core::marker::Sync for TimedTextStyle {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct TimedTextSubformat(pub ::windows::core::IInspectable); impl TimedTextSubformat { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<TimedTextSubformat, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } pub fn StartIndex(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } pub fn SetStartIndex(&self, value: i32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value).ok() } } pub fn Length(&self) -> ::windows::core::Result<i32> { let this = self; unsafe { let mut result__: i32 = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<i32>(result__) } } pub fn SetLength(&self, value: i32) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value).ok() } } pub fn SubformatStyle(&self) -> ::windows::core::Result<TimedTextStyle> { 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::<TimedTextStyle>(result__) } } pub fn SetSubformatStyle<'a, Param0: ::windows::core::IntoParam<'a, TimedTextStyle>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).11)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for TimedTextSubformat { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.TimedTextSubformat;{d713502f-3261-4722-a0c2-b937b2390f14})"); } unsafe impl ::windows::core::Interface for TimedTextSubformat { type Vtable = ITimedTextSubformat_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0xd713502f_3261_4722_a0c2_b937b2390f14); } impl ::windows::core::RuntimeName for TimedTextSubformat { const NAME: &'static str = "Windows.Media.Core.TimedTextSubformat"; } impl ::core::convert::From<TimedTextSubformat> for ::windows::core::IUnknown { fn from(value: TimedTextSubformat) -> Self { value.0 .0 } } impl ::core::convert::From<&TimedTextSubformat> for ::windows::core::IUnknown { fn from(value: &TimedTextSubformat) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for TimedTextSubformat { 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 TimedTextSubformat { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<TimedTextSubformat> for ::windows::core::IInspectable { fn from(value: TimedTextSubformat) -> Self { value.0 } } impl ::core::convert::From<&TimedTextSubformat> for ::windows::core::IInspectable { fn from(value: &TimedTextSubformat) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for TimedTextSubformat { 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 TimedTextSubformat { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for TimedTextSubformat {} unsafe impl ::core::marker::Sync for TimedTextSubformat {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextUnit(pub i32); impl TimedTextUnit { pub const Pixels: TimedTextUnit = TimedTextUnit(0i32); pub const Percentage: TimedTextUnit = TimedTextUnit(1i32); } impl ::core::convert::From<i32> for TimedTextUnit { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextUnit { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextUnit { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextUnit;i4)"); } impl ::windows::core::DefaultType for TimedTextUnit { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextWeight(pub i32); impl TimedTextWeight { pub const Normal: TimedTextWeight = TimedTextWeight(400i32); pub const Bold: TimedTextWeight = TimedTextWeight(700i32); } impl ::core::convert::From<i32> for TimedTextWeight { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextWeight { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextWeight { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextWeight;i4)"); } impl ::windows::core::DefaultType for TimedTextWeight { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextWrapping(pub i32); impl TimedTextWrapping { pub const NoWrap: TimedTextWrapping = TimedTextWrapping(0i32); pub const Wrap: TimedTextWrapping = TimedTextWrapping(1i32); } impl ::core::convert::From<i32> for TimedTextWrapping { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextWrapping { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextWrapping { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextWrapping;i4)"); } impl ::windows::core::DefaultType for TimedTextWrapping { type DefaultType = Self; } #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct TimedTextWritingMode(pub i32); impl TimedTextWritingMode { pub const LeftRightTopBottom: TimedTextWritingMode = TimedTextWritingMode(0i32); pub const RightLeftTopBottom: TimedTextWritingMode = TimedTextWritingMode(1i32); pub const TopBottomRightLeft: TimedTextWritingMode = TimedTextWritingMode(2i32); pub const TopBottomLeftRight: TimedTextWritingMode = TimedTextWritingMode(3i32); pub const LeftRight: TimedTextWritingMode = TimedTextWritingMode(4i32); pub const RightLeft: TimedTextWritingMode = TimedTextWritingMode(5i32); pub const TopBottom: TimedTextWritingMode = TimedTextWritingMode(6i32); } impl ::core::convert::From<i32> for TimedTextWritingMode { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for TimedTextWritingMode { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for TimedTextWritingMode { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.TimedTextWritingMode;i4)"); } impl ::windows::core::DefaultType for TimedTextWritingMode { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct VideoStabilizationEffect(pub ::windows::core::IInspectable); impl VideoStabilizationEffect { pub fn SetEnabled(&self, value: bool) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value).ok() } } pub fn Enabled(&self) -> ::windows::core::Result<bool> { let this = self; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } #[cfg(feature = "Foundation")] pub fn EnabledChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<VideoStabilizationEffect, VideoStabilizationEffectEnabledChangedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = self; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveEnabledChanged<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, cookie: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), cookie.into_param().abi()).ok() } } #[cfg(all(feature = "Media_Capture", feature = "Media_Devices", feature = "Media_MediaProperties"))] pub fn GetRecommendedStreamConfiguration<'a, Param0: ::windows::core::IntoParam<'a, super::Devices::VideoDeviceController>, Param1: ::windows::core::IntoParam<'a, super::MediaProperties::VideoEncodingProperties>>(&self, controller: Param0, desiredproperties: Param1) -> ::windows::core::Result<super::Capture::VideoStreamConfiguration> { let this = self; unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).10)(::core::mem::transmute_copy(this), controller.into_param().abi(), desiredproperties.into_param().abi(), &mut result__).from_abi::<super::Capture::VideoStreamConfiguration>(result__) } } #[cfg(feature = "Foundation_Collections")] pub fn SetProperties<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::Collections::IPropertySet>>(&self, configuration: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<super::IMediaExtension>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), configuration.into_param().abi()).ok() } } } unsafe impl ::windows::core::RuntimeType for VideoStabilizationEffect { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.VideoStabilizationEffect;{0808a650-9698-4e57-877b-bd7cb2ee0f8a})"); } unsafe impl ::windows::core::Interface for VideoStabilizationEffect { type Vtable = IVideoStabilizationEffect_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x0808a650_9698_4e57_877b_bd7cb2ee0f8a); } impl ::windows::core::RuntimeName for VideoStabilizationEffect { const NAME: &'static str = "Windows.Media.Core.VideoStabilizationEffect"; } impl ::core::convert::From<VideoStabilizationEffect> for ::windows::core::IUnknown { fn from(value: VideoStabilizationEffect) -> Self { value.0 .0 } } impl ::core::convert::From<&VideoStabilizationEffect> for ::windows::core::IUnknown { fn from(value: &VideoStabilizationEffect) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for VideoStabilizationEffect { 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 VideoStabilizationEffect { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<VideoStabilizationEffect> for ::windows::core::IInspectable { fn from(value: VideoStabilizationEffect) -> Self { value.0 } } impl ::core::convert::From<&VideoStabilizationEffect> for ::windows::core::IInspectable { fn from(value: &VideoStabilizationEffect) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for VideoStabilizationEffect { 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 VideoStabilizationEffect { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<VideoStabilizationEffect> for super::IMediaExtension { type Error = ::windows::core::Error; fn try_from(value: VideoStabilizationEffect) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&VideoStabilizationEffect> for super::IMediaExtension { type Error = ::windows::core::Error; fn try_from(value: &VideoStabilizationEffect) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, super::IMediaExtension> for VideoStabilizationEffect { fn into_param(self) -> ::windows::core::Param<'a, super::IMediaExtension> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, super::IMediaExtension> for &VideoStabilizationEffect { fn into_param(self) -> ::windows::core::Param<'a, super::IMediaExtension> { ::core::convert::TryInto::<super::IMediaExtension>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for VideoStabilizationEffect {} unsafe impl ::core::marker::Sync for VideoStabilizationEffect {} #[cfg(feature = "Media_Effects")] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct VideoStabilizationEffectDefinition(pub ::windows::core::IInspectable); #[cfg(feature = "Media_Effects")] impl VideoStabilizationEffectDefinition { pub fn new() -> ::windows::core::Result<Self> { Self::IActivationFactory(|f| f.activate_instance::<Self>()) } fn IActivationFactory<R, F: FnOnce(&::windows::core::IActivationFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<VideoStabilizationEffectDefinition, ::windows::core::IActivationFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } #[cfg(feature = "Media_Effects")] pub fn ActivatableClassId(&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 = "Media_Effects"))] pub fn Properties(&self) -> ::windows::core::Result<super::super::Foundation::Collections::IPropertySet> { 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::Foundation::Collections::IPropertySet>(result__) } } } #[cfg(feature = "Media_Effects")] unsafe impl ::windows::core::RuntimeType for VideoStabilizationEffectDefinition { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.VideoStabilizationEffectDefinition;{39f38cf0-8d0f-4f3e-84fc-2d46a5297943})"); } #[cfg(feature = "Media_Effects")] unsafe impl ::windows::core::Interface for VideoStabilizationEffectDefinition { type Vtable = super::Effects::IVideoEffectDefinition_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x39f38cf0_8d0f_4f3e_84fc_2d46a5297943); } #[cfg(feature = "Media_Effects")] impl ::windows::core::RuntimeName for VideoStabilizationEffectDefinition { const NAME: &'static str = "Windows.Media.Core.VideoStabilizationEffectDefinition"; } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<VideoStabilizationEffectDefinition> for ::windows::core::IUnknown { fn from(value: VideoStabilizationEffectDefinition) -> Self { value.0 .0 } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<&VideoStabilizationEffectDefinition> for ::windows::core::IUnknown { fn from(value: &VideoStabilizationEffectDefinition) -> Self { value.0 .0.clone() } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for VideoStabilizationEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Owned(self.0 .0) } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for &'a VideoStabilizationEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<VideoStabilizationEffectDefinition> for ::windows::core::IInspectable { fn from(value: VideoStabilizationEffectDefinition) -> Self { value.0 } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<&VideoStabilizationEffectDefinition> for ::windows::core::IInspectable { fn from(value: &VideoStabilizationEffectDefinition) -> Self { value.0.clone() } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for VideoStabilizationEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Owned(self.0) } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for &'a VideoStabilizationEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<VideoStabilizationEffectDefinition> for super::Effects::IVideoEffectDefinition { fn from(value: VideoStabilizationEffectDefinition) -> Self { unsafe { ::core::mem::transmute(value) } } } #[cfg(feature = "Media_Effects")] impl ::core::convert::From<&VideoStabilizationEffectDefinition> for super::Effects::IVideoEffectDefinition { fn from(value: &VideoStabilizationEffectDefinition) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, super::Effects::IVideoEffectDefinition> for VideoStabilizationEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, super::Effects::IVideoEffectDefinition> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Media_Effects")] impl<'a> ::windows::core::IntoParam<'a, super::Effects::IVideoEffectDefinition> for &VideoStabilizationEffectDefinition { fn into_param(self) -> ::windows::core::Param<'a, super::Effects::IVideoEffectDefinition> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } #[cfg(feature = "Media_Effects")] unsafe impl ::core::marker::Send for VideoStabilizationEffectDefinition {} #[cfg(feature = "Media_Effects")] unsafe impl ::core::marker::Sync for VideoStabilizationEffectDefinition {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct VideoStabilizationEffectEnabledChangedEventArgs(pub ::windows::core::IInspectable); impl VideoStabilizationEffectEnabledChangedEventArgs { pub fn Reason(&self) -> ::windows::core::Result<VideoStabilizationEffectEnabledChangedReason> { let this = self; unsafe { let mut result__: VideoStabilizationEffectEnabledChangedReason = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<VideoStabilizationEffectEnabledChangedReason>(result__) } } } unsafe impl ::windows::core::RuntimeType for VideoStabilizationEffectEnabledChangedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.VideoStabilizationEffectEnabledChangedEventArgs;{187eff28-67bb-4713-b900-4168da164529})"); } unsafe impl ::windows::core::Interface for VideoStabilizationEffectEnabledChangedEventArgs { type Vtable = IVideoStabilizationEffectEnabledChangedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x187eff28_67bb_4713_b900_4168da164529); } impl ::windows::core::RuntimeName for VideoStabilizationEffectEnabledChangedEventArgs { const NAME: &'static str = "Windows.Media.Core.VideoStabilizationEffectEnabledChangedEventArgs"; } impl ::core::convert::From<VideoStabilizationEffectEnabledChangedEventArgs> for ::windows::core::IUnknown { fn from(value: VideoStabilizationEffectEnabledChangedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&VideoStabilizationEffectEnabledChangedEventArgs> for ::windows::core::IUnknown { fn from(value: &VideoStabilizationEffectEnabledChangedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for VideoStabilizationEffectEnabledChangedEventArgs { 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 VideoStabilizationEffectEnabledChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<VideoStabilizationEffectEnabledChangedEventArgs> for ::windows::core::IInspectable { fn from(value: VideoStabilizationEffectEnabledChangedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&VideoStabilizationEffectEnabledChangedEventArgs> for ::windows::core::IInspectable { fn from(value: &VideoStabilizationEffectEnabledChangedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for VideoStabilizationEffectEnabledChangedEventArgs { 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 VideoStabilizationEffectEnabledChangedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for VideoStabilizationEffectEnabledChangedEventArgs {} unsafe impl ::core::marker::Sync for VideoStabilizationEffectEnabledChangedEventArgs {} #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)] pub struct VideoStabilizationEffectEnabledChangedReason(pub i32); impl VideoStabilizationEffectEnabledChangedReason { pub const Programmatic: VideoStabilizationEffectEnabledChangedReason = VideoStabilizationEffectEnabledChangedReason(0i32); pub const PixelRateTooHigh: VideoStabilizationEffectEnabledChangedReason = VideoStabilizationEffectEnabledChangedReason(1i32); pub const RunningSlowly: VideoStabilizationEffectEnabledChangedReason = VideoStabilizationEffectEnabledChangedReason(2i32); } impl ::core::convert::From<i32> for VideoStabilizationEffectEnabledChangedReason { fn from(value: i32) -> Self { Self(value) } } unsafe impl ::windows::core::Abi for VideoStabilizationEffectEnabledChangedReason { type Abi = Self; } unsafe impl ::windows::core::RuntimeType for VideoStabilizationEffectEnabledChangedReason { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"enum(Windows.Media.Core.VideoStabilizationEffectEnabledChangedReason;i4)"); } impl ::windows::core::DefaultType for VideoStabilizationEffectEnabledChangedReason { type DefaultType = Self; } #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct VideoStreamDescriptor(pub ::windows::core::IInspectable); impl VideoStreamDescriptor { #[cfg(feature = "Media_MediaProperties")] pub fn EncodingProperties(&self) -> ::windows::core::Result<super::MediaProperties::VideoEncodingProperties> { 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::<super::MediaProperties::VideoEncodingProperties>(result__) } } pub fn IsSelected(&self) -> ::windows::core::Result<bool> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(self)?; unsafe { let mut result__: bool = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<bool>(result__) } } pub fn SetName<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(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 SetLanguage<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(self)?; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Language(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor>(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__) } } #[cfg(feature = "Media_MediaProperties")] pub fn Create<'a, Param0: ::windows::core::IntoParam<'a, super::MediaProperties::VideoEncodingProperties>>(encodingproperties: Param0) -> ::windows::core::Result<VideoStreamDescriptor> { Self::IVideoStreamDescriptorFactory(|this| unsafe { let mut result__: ::windows::core::RawPtr = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), encodingproperties.into_param().abi(), &mut result__).from_abi::<VideoStreamDescriptor>(result__) }) } pub fn SetLabel<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor2>(self)?; unsafe { (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Label(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IMediaStreamDescriptor2>(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 Copy(&self) -> ::windows::core::Result<VideoStreamDescriptor> { let this = &::windows::core::Interface::cast::<IVideoStreamDescriptor2>(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::<VideoStreamDescriptor>(result__) } } pub fn IVideoStreamDescriptorFactory<R, F: FnOnce(&IVideoStreamDescriptorFactory) -> ::windows::core::Result<R>>(callback: F) -> ::windows::core::Result<R> { static mut SHARED: ::windows::core::FactoryCache<VideoStreamDescriptor, IVideoStreamDescriptorFactory> = ::windows::core::FactoryCache::new(); unsafe { SHARED.call(callback) } } } unsafe impl ::windows::core::RuntimeType for VideoStreamDescriptor { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.VideoStreamDescriptor;{12ee0d55-9c2b-4440-8057-2c7a90f0cbec})"); } unsafe impl ::windows::core::Interface for VideoStreamDescriptor { type Vtable = IVideoStreamDescriptor_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x12ee0d55_9c2b_4440_8057_2c7a90f0cbec); } impl ::windows::core::RuntimeName for VideoStreamDescriptor { const NAME: &'static str = "Windows.Media.Core.VideoStreamDescriptor"; } impl ::core::convert::From<VideoStreamDescriptor> for ::windows::core::IUnknown { fn from(value: VideoStreamDescriptor) -> Self { value.0 .0 } } impl ::core::convert::From<&VideoStreamDescriptor> for ::windows::core::IUnknown { fn from(value: &VideoStreamDescriptor) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for VideoStreamDescriptor { 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 VideoStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<VideoStreamDescriptor> for ::windows::core::IInspectable { fn from(value: VideoStreamDescriptor) -> Self { value.0 } } impl ::core::convert::From<&VideoStreamDescriptor> for ::windows::core::IInspectable { fn from(value: &VideoStreamDescriptor) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for VideoStreamDescriptor { 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 VideoStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::TryFrom<VideoStreamDescriptor> for IMediaStreamDescriptor { type Error = ::windows::core::Error; fn try_from(value: VideoStreamDescriptor) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&VideoStreamDescriptor> for IMediaStreamDescriptor { type Error = ::windows::core::Error; fn try_from(value: &VideoStreamDescriptor) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor> for VideoStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor> for &VideoStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor> { ::core::convert::TryInto::<IMediaStreamDescriptor>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } impl ::core::convert::TryFrom<VideoStreamDescriptor> for IMediaStreamDescriptor2 { type Error = ::windows::core::Error; fn try_from(value: VideoStreamDescriptor) -> ::windows::core::Result<Self> { ::core::convert::TryFrom::try_from(&value) } } impl ::core::convert::TryFrom<&VideoStreamDescriptor> for IMediaStreamDescriptor2 { type Error = ::windows::core::Error; fn try_from(value: &VideoStreamDescriptor) -> ::windows::core::Result<Self> { ::windows::core::Interface::cast(value) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor2> for VideoStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor2> { ::windows::core::IntoParam::into_param(&self) } } impl<'a> ::windows::core::IntoParam<'a, IMediaStreamDescriptor2> for &VideoStreamDescriptor { fn into_param(self) -> ::windows::core::Param<'a, IMediaStreamDescriptor2> { ::core::convert::TryInto::<IMediaStreamDescriptor2>::try_into(self).map(::windows::core::Param::Owned).unwrap_or(::windows::core::Param::None) } } unsafe impl ::core::marker::Send for VideoStreamDescriptor {} unsafe impl ::core::marker::Sync for VideoStreamDescriptor {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct VideoTrack(pub ::windows::core::IInspectable); impl VideoTrack { pub fn Id(&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 Language(&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 TrackKind(&self) -> ::windows::core::Result<MediaTrackKind> { let this = self; unsafe { let mut result__: MediaTrackKind = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).8)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MediaTrackKind>(result__) } } pub fn SetLabel<'a, Param0: ::windows::core::IntoParam<'a, ::windows::core::HSTRING>>(&self, value: Param0) -> ::windows::core::Result<()> { let this = self; unsafe { (::windows::core::Interface::vtable(this).9)(::core::mem::transmute_copy(this), value.into_param().abi()).ok() } } pub fn Label(&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__) } } #[cfg(feature = "Foundation")] pub fn OpenFailed<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::TypedEventHandler<VideoTrack, VideoTrackOpenFailedEventArgs>>>(&self, handler: Param0) -> ::windows::core::Result<super::super::Foundation::EventRegistrationToken> { let this = &::windows::core::Interface::cast::<IVideoTrack>(self)?; unsafe { let mut result__: 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::Foundation::EventRegistrationToken>(result__) } } #[cfg(feature = "Foundation")] pub fn RemoveOpenFailed<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::EventRegistrationToken>>(&self, token: Param0) -> ::windows::core::Result<()> { let this = &::windows::core::Interface::cast::<IVideoTrack>(self)?; unsafe { (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), token.into_param().abi()).ok() } } #[cfg(feature = "Media_MediaProperties")] pub fn GetEncodingProperties(&self) -> ::windows::core::Result<super::MediaProperties::VideoEncodingProperties> { let this = &::windows::core::Interface::cast::<IVideoTrack>(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::MediaProperties::VideoEncodingProperties>(result__) } } #[cfg(feature = "Media_Playback")] pub fn PlaybackItem(&self) -> ::windows::core::Result<super::Playback::MediaPlaybackItem> { let this = &::windows::core::Interface::cast::<IVideoTrack>(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::Playback::MediaPlaybackItem>(result__) } } pub fn Name(&self) -> ::windows::core::Result<::windows::core::HSTRING> { let this = &::windows::core::Interface::cast::<IVideoTrack>(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 SupportInfo(&self) -> ::windows::core::Result<VideoTrackSupportInfo> { let this = &::windows::core::Interface::cast::<IVideoTrack>(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::<VideoTrackSupportInfo>(result__) } } } unsafe impl ::windows::core::RuntimeType for VideoTrack { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.VideoTrack;{03e1fafc-c931-491a-b46b-c10ee8c256b7})"); } unsafe impl ::windows::core::Interface for VideoTrack { type Vtable = IMediaTrack_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x03e1fafc_c931_491a_b46b_c10ee8c256b7); } impl ::windows::core::RuntimeName for VideoTrack { const NAME: &'static str = "Windows.Media.Core.VideoTrack"; } impl ::core::convert::From<VideoTrack> for ::windows::core::IUnknown { fn from(value: VideoTrack) -> Self { value.0 .0 } } impl ::core::convert::From<&VideoTrack> for ::windows::core::IUnknown { fn from(value: &VideoTrack) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for VideoTrack { 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 VideoTrack { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<VideoTrack> for ::windows::core::IInspectable { fn from(value: VideoTrack) -> Self { value.0 } } impl ::core::convert::From<&VideoTrack> for ::windows::core::IInspectable { fn from(value: &VideoTrack) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for VideoTrack { 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 VideoTrack { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } impl ::core::convert::From<VideoTrack> for IMediaTrack { fn from(value: VideoTrack) -> Self { unsafe { ::core::mem::transmute(value) } } } impl ::core::convert::From<&VideoTrack> for IMediaTrack { fn from(value: &VideoTrack) -> Self { ::core::convert::From::from(::core::clone::Clone::clone(value)) } } impl<'a> ::windows::core::IntoParam<'a, IMediaTrack> for VideoTrack { fn into_param(self) -> ::windows::core::Param<'a, IMediaTrack> { ::windows::core::Param::Owned(unsafe { ::core::mem::transmute(self) }) } } impl<'a> ::windows::core::IntoParam<'a, IMediaTrack> for &VideoTrack { fn into_param(self) -> ::windows::core::Param<'a, IMediaTrack> { ::windows::core::Param::Borrowed(unsafe { ::core::mem::transmute(self) }) } } unsafe impl ::core::marker::Send for VideoTrack {} unsafe impl ::core::marker::Sync for VideoTrack {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct VideoTrackOpenFailedEventArgs(pub ::windows::core::IInspectable); impl VideoTrackOpenFailedEventArgs { pub fn ExtendedError(&self) -> ::windows::core::Result<::windows::core::HRESULT> { let this = self; unsafe { let mut result__: ::windows::core::HRESULT = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<::windows::core::HRESULT>(result__) } } } unsafe impl ::windows::core::RuntimeType for VideoTrackOpenFailedEventArgs { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.VideoTrackOpenFailedEventArgs;{7679e231-04f9-4c82-a4ee-8602c8bb4754})"); } unsafe impl ::windows::core::Interface for VideoTrackOpenFailedEventArgs { type Vtable = IVideoTrackOpenFailedEventArgs_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x7679e231_04f9_4c82_a4ee_8602c8bb4754); } impl ::windows::core::RuntimeName for VideoTrackOpenFailedEventArgs { const NAME: &'static str = "Windows.Media.Core.VideoTrackOpenFailedEventArgs"; } impl ::core::convert::From<VideoTrackOpenFailedEventArgs> for ::windows::core::IUnknown { fn from(value: VideoTrackOpenFailedEventArgs) -> Self { value.0 .0 } } impl ::core::convert::From<&VideoTrackOpenFailedEventArgs> for ::windows::core::IUnknown { fn from(value: &VideoTrackOpenFailedEventArgs) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for VideoTrackOpenFailedEventArgs { 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 VideoTrackOpenFailedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<VideoTrackOpenFailedEventArgs> for ::windows::core::IInspectable { fn from(value: VideoTrackOpenFailedEventArgs) -> Self { value.0 } } impl ::core::convert::From<&VideoTrackOpenFailedEventArgs> for ::windows::core::IInspectable { fn from(value: &VideoTrackOpenFailedEventArgs) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for VideoTrackOpenFailedEventArgs { 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 VideoTrackOpenFailedEventArgs { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for VideoTrackOpenFailedEventArgs {} unsafe impl ::core::marker::Sync for VideoTrackOpenFailedEventArgs {} #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct VideoTrackSupportInfo(pub ::windows::core::IInspectable); impl VideoTrackSupportInfo { pub fn DecoderStatus(&self) -> ::windows::core::Result<MediaDecoderStatus> { let this = self; unsafe { let mut result__: MediaDecoderStatus = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).6)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MediaDecoderStatus>(result__) } } pub fn MediaSourceStatus(&self) -> ::windows::core::Result<MediaSourceStatus> { let this = self; unsafe { let mut result__: MediaSourceStatus = ::core::mem::zeroed(); (::windows::core::Interface::vtable(this).7)(::core::mem::transmute_copy(this), &mut result__).from_abi::<MediaSourceStatus>(result__) } } } unsafe impl ::windows::core::RuntimeType for VideoTrackSupportInfo { const SIGNATURE: ::windows::core::ConstBuffer = ::windows::core::ConstBuffer::from_slice(b"rc(Windows.Media.Core.VideoTrackSupportInfo;{4bb534a0-fc5f-450d-8ff0-778d590486de})"); } unsafe impl ::windows::core::Interface for VideoTrackSupportInfo { type Vtable = IVideoTrackSupportInfo_abi; const IID: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x4bb534a0_fc5f_450d_8ff0_778d590486de); } impl ::windows::core::RuntimeName for VideoTrackSupportInfo { const NAME: &'static str = "Windows.Media.Core.VideoTrackSupportInfo"; } impl ::core::convert::From<VideoTrackSupportInfo> for ::windows::core::IUnknown { fn from(value: VideoTrackSupportInfo) -> Self { value.0 .0 } } impl ::core::convert::From<&VideoTrackSupportInfo> for ::windows::core::IUnknown { fn from(value: &VideoTrackSupportInfo) -> Self { value.0 .0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IUnknown> for VideoTrackSupportInfo { 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 VideoTrackSupportInfo { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IUnknown> { ::windows::core::Param::Borrowed(&self.0 .0) } } impl ::core::convert::From<VideoTrackSupportInfo> for ::windows::core::IInspectable { fn from(value: VideoTrackSupportInfo) -> Self { value.0 } } impl ::core::convert::From<&VideoTrackSupportInfo> for ::windows::core::IInspectable { fn from(value: &VideoTrackSupportInfo) -> Self { value.0.clone() } } impl<'a> ::windows::core::IntoParam<'a, ::windows::core::IInspectable> for VideoTrackSupportInfo { 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 VideoTrackSupportInfo { fn into_param(self) -> ::windows::core::Param<'a, ::windows::core::IInspectable> { ::windows::core::Param::Borrowed(&self.0) } } unsafe impl ::core::marker::Send for VideoTrackSupportInfo {} unsafe impl ::core::marker::Sync for VideoTrackSupportInfo {}
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - OTFDEC control register"] pub cr: CR, _reserved1: [u8; 28usize], #[doc = "0x20 - OTFDEC region x configuration register"] pub r1cfgr: R1CFGR, #[doc = "0x24 - OTFDEC region x start address register"] pub r1startaddr: R1STARTADDR, #[doc = "0x28 - OTFDEC region x end address register"] pub r1endaddr: R1ENDADDR, #[doc = "0x2c - OTFDEC region x nonce register 0"] pub r1noncer0: R1NONCER0, #[doc = "0x30 - OTFDEC region x nonce register 1"] pub r1noncer1: R1NONCER1, #[doc = "0x34 - OTFDEC region x key register 0"] pub r1keyr0: R1KEYR0, #[doc = "0x38 - OTFDEC region x key register 1"] pub r1keyr1: R1KEYR1, #[doc = "0x3c - OTFDEC region x key register 2"] pub r1keyr2: R1KEYR2, #[doc = "0x40 - OTFDEC region x key register 3"] pub r1keyr3: R1KEYR3, _reserved10: [u8; 12usize], #[doc = "0x50 - OTFDEC region x configuration register"] pub r2cfgr: R2CFGR, #[doc = "0x54 - OTFDEC region x start address register"] pub r2startaddr: R2STARTADDR, #[doc = "0x58 - OTFDEC region x end address register"] pub r2endaddr: R2ENDADDR, #[doc = "0x5c - OTFDEC region x nonce register 0"] pub r2noncer0: R2NONCER0, #[doc = "0x60 - OTFDEC region x nonce register 1"] pub r2noncer1: R2NONCER1, #[doc = "0x64 - OTFDEC region x key register 0"] pub r2keyr0: R2KEYR0, #[doc = "0x68 - OTFDEC region x key register 1"] pub r2keyr1: R2KEYR1, #[doc = "0x6c - OTFDEC region x key register 2"] pub r2keyr2: R2KEYR2, #[doc = "0x70 - OTFDEC region x key register 3"] pub r2keyr3: R2KEYR3, _reserved19: [u8; 12usize], #[doc = "0x80 - OTFDEC region x configuration register"] pub r3cfgr: R3CFGR, #[doc = "0x84 - OTFDEC region x start address register"] pub r3startaddr: R3STARTADDR, #[doc = "0x88 - OTFDEC region x end address register"] pub r3endaddr: R3ENDADDR, _reserved_22_r3noncer0: [u8; 4usize], #[doc = "0x90 - OTFDEC region x nonce register 1"] pub r3noncer1: R3NONCER1, #[doc = "0x94 - OTFDEC region x key register 0"] pub r3keyr0: R3KEYR0, #[doc = "0x98 - OTFDEC region x key register 1"] pub r3keyr1: R3KEYR1, #[doc = "0x9c - OTFDEC region x key register 2"] pub r3keyr2: R3KEYR2, #[doc = "0xa0 - OTFDEC region x key register 3"] pub r3keyr3: R3KEYR3, _reserved28: [u8; 12usize], #[doc = "0xb0 - OTFDEC region x configuration register"] pub r4cfgr: R4CFGR, #[doc = "0xb4 - OTFDEC region x start address register"] pub r4startaddr: R4STARTADDR, _reserved30: [u8; 4usize], #[doc = "0xbc - OTFDEC region x nonce register 0"] pub r4noncer0: R4NONCER0, #[doc = "0xc0 - OTFDEC region x nonce register 1"] pub r4noncer1: R4NONCER1, #[doc = "0xc4 - OTFDEC region x key register 0"] pub r4keyr0: R4KEYR0, #[doc = "0xc8 - OTFDEC region x key register 1"] pub r4keyr1: R4KEYR1, #[doc = "0xcc - OTFDEC region x key register 2"] pub r4keyr2: R4KEYR2, #[doc = "0xd0 - OTFDEC region x key register 3"] pub r4keyr3: R4KEYR3, _reserved36: [u8; 556usize], #[doc = "0x300 - OTFDEC interrupt status register"] pub isr: ISR, #[doc = "0x304 - OTFDEC interrupt clear register"] pub icr: ICR, #[doc = "0x308 - OTFDEC interrupt enable register"] pub ier: IER, } impl RegisterBlock { #[doc = "0x8c - OTFDEC region x nonce register 0"] #[inline(always)] pub fn r3noncer0(&self) -> &R3NONCER0 { unsafe { &*(((self as *const Self) as *const u8).add(140usize) as *const R3NONCER0) } } #[doc = "0x8c - OTFDEC region x nonce register 0"] #[inline(always)] pub fn r3noncer0_mut(&self) -> &mut R3NONCER0 { unsafe { &mut *(((self as *const Self) as *mut u8).add(140usize) as *mut R3NONCER0) } } #[doc = "0x8c - OTFDEC region x end address register"] #[inline(always)] pub fn r4endaddr(&self) -> &R4ENDADDR { unsafe { &*(((self as *const Self) as *const u8).add(140usize) as *const R4ENDADDR) } } #[doc = "0x8c - OTFDEC region x end address register"] #[inline(always)] pub fn r4endaddr_mut(&self) -> &mut R4ENDADDR { unsafe { &mut *(((self as *const Self) as *mut u8).add(140usize) as *mut R4ENDADDR) } } } #[doc = "OTFDEC control register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr](cr) module"] pub type CR = crate::Reg<u32, _CR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _CR; #[doc = "`read()` method returns [cr::R](cr::R) reader structure"] impl crate::Readable for CR {} #[doc = "`write(|w| ..)` method takes [cr::W](cr::W) writer structure"] impl crate::Writable for CR {} #[doc = "OTFDEC control register"] pub mod cr; #[doc = "OTFDEC region x configuration register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r1cfgr](r1cfgr) module"] pub type R1CFGR = crate::Reg<u32, _R1CFGR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R1CFGR; #[doc = "`read()` method returns [r1cfgr::R](r1cfgr::R) reader structure"] impl crate::Readable for R1CFGR {} #[doc = "`write(|w| ..)` method takes [r1cfgr::W](r1cfgr::W) writer structure"] impl crate::Writable for R1CFGR {} #[doc = "OTFDEC region x configuration register"] pub mod r1cfgr; #[doc = "OTFDEC region x configuration register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r2cfgr](r2cfgr) module"] pub type R2CFGR = crate::Reg<u32, _R2CFGR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R2CFGR; #[doc = "`read()` method returns [r2cfgr::R](r2cfgr::R) reader structure"] impl crate::Readable for R2CFGR {} #[doc = "`write(|w| ..)` method takes [r2cfgr::W](r2cfgr::W) writer structure"] impl crate::Writable for R2CFGR {} #[doc = "OTFDEC region x configuration register"] pub mod r2cfgr; #[doc = "OTFDEC region x configuration register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r3cfgr](r3cfgr) module"] pub type R3CFGR = crate::Reg<u32, _R3CFGR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R3CFGR; #[doc = "`read()` method returns [r3cfgr::R](r3cfgr::R) reader structure"] impl crate::Readable for R3CFGR {} #[doc = "`write(|w| ..)` method takes [r3cfgr::W](r3cfgr::W) writer structure"] impl crate::Writable for R3CFGR {} #[doc = "OTFDEC region x configuration register"] pub mod r3cfgr; #[doc = "OTFDEC region x configuration register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r4cfgr](r4cfgr) module"] pub type R4CFGR = crate::Reg<u32, _R4CFGR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R4CFGR; #[doc = "`read()` method returns [r4cfgr::R](r4cfgr::R) reader structure"] impl crate::Readable for R4CFGR {} #[doc = "`write(|w| ..)` method takes [r4cfgr::W](r4cfgr::W) writer structure"] impl crate::Writable for R4CFGR {} #[doc = "OTFDEC region x configuration register"] pub mod r4cfgr; #[doc = "OTFDEC region x start address register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r1startaddr](r1startaddr) module"] pub type R1STARTADDR = crate::Reg<u32, _R1STARTADDR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R1STARTADDR; #[doc = "`read()` method returns [r1startaddr::R](r1startaddr::R) reader structure"] impl crate::Readable for R1STARTADDR {} #[doc = "`write(|w| ..)` method takes [r1startaddr::W](r1startaddr::W) writer structure"] impl crate::Writable for R1STARTADDR {} #[doc = "OTFDEC region x start address register"] pub mod r1startaddr; #[doc = "OTFDEC region x start address register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r2startaddr](r2startaddr) module"] pub type R2STARTADDR = crate::Reg<u32, _R2STARTADDR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R2STARTADDR; #[doc = "`read()` method returns [r2startaddr::R](r2startaddr::R) reader structure"] impl crate::Readable for R2STARTADDR {} #[doc = "`write(|w| ..)` method takes [r2startaddr::W](r2startaddr::W) writer structure"] impl crate::Writable for R2STARTADDR {} #[doc = "OTFDEC region x start address register"] pub mod r2startaddr; #[doc = "OTFDEC region x start address register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r3startaddr](r3startaddr) module"] pub type R3STARTADDR = crate::Reg<u32, _R3STARTADDR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R3STARTADDR; #[doc = "`read()` method returns [r3startaddr::R](r3startaddr::R) reader structure"] impl crate::Readable for R3STARTADDR {} #[doc = "`write(|w| ..)` method takes [r3startaddr::W](r3startaddr::W) writer structure"] impl crate::Writable for R3STARTADDR {} #[doc = "OTFDEC region x start address register"] pub mod r3startaddr; #[doc = "OTFDEC region x start address register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r4startaddr](r4startaddr) module"] pub type R4STARTADDR = crate::Reg<u32, _R4STARTADDR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R4STARTADDR; #[doc = "`read()` method returns [r4startaddr::R](r4startaddr::R) reader structure"] impl crate::Readable for R4STARTADDR {} #[doc = "`write(|w| ..)` method takes [r4startaddr::W](r4startaddr::W) writer structure"] impl crate::Writable for R4STARTADDR {} #[doc = "OTFDEC region x start address register"] pub mod r4startaddr; #[doc = "OTFDEC region x end address register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r1endaddr](r1endaddr) module"] pub type R1ENDADDR = crate::Reg<u32, _R1ENDADDR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R1ENDADDR; #[doc = "`read()` method returns [r1endaddr::R](r1endaddr::R) reader structure"] impl crate::Readable for R1ENDADDR {} #[doc = "`write(|w| ..)` method takes [r1endaddr::W](r1endaddr::W) writer structure"] impl crate::Writable for R1ENDADDR {} #[doc = "OTFDEC region x end address register"] pub mod r1endaddr; #[doc = "OTFDEC region x end address register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r2endaddr](r2endaddr) module"] pub type R2ENDADDR = crate::Reg<u32, _R2ENDADDR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R2ENDADDR; #[doc = "`read()` method returns [r2endaddr::R](r2endaddr::R) reader structure"] impl crate::Readable for R2ENDADDR {} #[doc = "`write(|w| ..)` method takes [r2endaddr::W](r2endaddr::W) writer structure"] impl crate::Writable for R2ENDADDR {} #[doc = "OTFDEC region x end address register"] pub mod r2endaddr; #[doc = "OTFDEC region x end address register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r3endaddr](r3endaddr) module"] pub type R3ENDADDR = crate::Reg<u32, _R3ENDADDR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R3ENDADDR; #[doc = "`read()` method returns [r3endaddr::R](r3endaddr::R) reader structure"] impl crate::Readable for R3ENDADDR {} #[doc = "`write(|w| ..)` method takes [r3endaddr::W](r3endaddr::W) writer structure"] impl crate::Writable for R3ENDADDR {} #[doc = "OTFDEC region x end address register"] pub mod r3endaddr; #[doc = "OTFDEC region x end address register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r4endaddr](r4endaddr) module"] pub type R4ENDADDR = crate::Reg<u32, _R4ENDADDR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R4ENDADDR; #[doc = "`read()` method returns [r4endaddr::R](r4endaddr::R) reader structure"] impl crate::Readable for R4ENDADDR {} #[doc = "`write(|w| ..)` method takes [r4endaddr::W](r4endaddr::W) writer structure"] impl crate::Writable for R4ENDADDR {} #[doc = "OTFDEC region x end address register"] pub mod r4endaddr; #[doc = "OTFDEC region x nonce register 0\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r1noncer0](r1noncer0) module"] pub type R1NONCER0 = crate::Reg<u32, _R1NONCER0>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R1NONCER0; #[doc = "`read()` method returns [r1noncer0::R](r1noncer0::R) reader structure"] impl crate::Readable for R1NONCER0 {} #[doc = "`write(|w| ..)` method takes [r1noncer0::W](r1noncer0::W) writer structure"] impl crate::Writable for R1NONCER0 {} #[doc = "OTFDEC region x nonce register 0"] pub mod r1noncer0; #[doc = "OTFDEC region x nonce register 0\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r2noncer0](r2noncer0) module"] pub type R2NONCER0 = crate::Reg<u32, _R2NONCER0>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R2NONCER0; #[doc = "`read()` method returns [r2noncer0::R](r2noncer0::R) reader structure"] impl crate::Readable for R2NONCER0 {} #[doc = "`write(|w| ..)` method takes [r2noncer0::W](r2noncer0::W) writer structure"] impl crate::Writable for R2NONCER0 {} #[doc = "OTFDEC region x nonce register 0"] pub mod r2noncer0; #[doc = "OTFDEC region x nonce register 0\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r3noncer0](r3noncer0) module"] pub type R3NONCER0 = crate::Reg<u32, _R3NONCER0>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R3NONCER0; #[doc = "`read()` method returns [r3noncer0::R](r3noncer0::R) reader structure"] impl crate::Readable for R3NONCER0 {} #[doc = "`write(|w| ..)` method takes [r3noncer0::W](r3noncer0::W) writer structure"] impl crate::Writable for R3NONCER0 {} #[doc = "OTFDEC region x nonce register 0"] pub mod r3noncer0; #[doc = "OTFDEC region x nonce register 0\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r4noncer0](r4noncer0) module"] pub type R4NONCER0 = crate::Reg<u32, _R4NONCER0>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R4NONCER0; #[doc = "`read()` method returns [r4noncer0::R](r4noncer0::R) reader structure"] impl crate::Readable for R4NONCER0 {} #[doc = "`write(|w| ..)` method takes [r4noncer0::W](r4noncer0::W) writer structure"] impl crate::Writable for R4NONCER0 {} #[doc = "OTFDEC region x nonce register 0"] pub mod r4noncer0; #[doc = "OTFDEC region x nonce register 1\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r1noncer1](r1noncer1) module"] pub type R1NONCER1 = crate::Reg<u32, _R1NONCER1>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R1NONCER1; #[doc = "`read()` method returns [r1noncer1::R](r1noncer1::R) reader structure"] impl crate::Readable for R1NONCER1 {} #[doc = "`write(|w| ..)` method takes [r1noncer1::W](r1noncer1::W) writer structure"] impl crate::Writable for R1NONCER1 {} #[doc = "OTFDEC region x nonce register 1"] pub mod r1noncer1; #[doc = "OTFDEC region x nonce register 1\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r2noncer1](r2noncer1) module"] pub type R2NONCER1 = crate::Reg<u32, _R2NONCER1>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R2NONCER1; #[doc = "`read()` method returns [r2noncer1::R](r2noncer1::R) reader structure"] impl crate::Readable for R2NONCER1 {} #[doc = "`write(|w| ..)` method takes [r2noncer1::W](r2noncer1::W) writer structure"] impl crate::Writable for R2NONCER1 {} #[doc = "OTFDEC region x nonce register 1"] pub mod r2noncer1; #[doc = "OTFDEC region x nonce register 1\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r3noncer1](r3noncer1) module"] pub type R3NONCER1 = crate::Reg<u32, _R3NONCER1>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R3NONCER1; #[doc = "`read()` method returns [r3noncer1::R](r3noncer1::R) reader structure"] impl crate::Readable for R3NONCER1 {} #[doc = "`write(|w| ..)` method takes [r3noncer1::W](r3noncer1::W) writer structure"] impl crate::Writable for R3NONCER1 {} #[doc = "OTFDEC region x nonce register 1"] pub mod r3noncer1; #[doc = "OTFDEC region x nonce register 1\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r4noncer1](r4noncer1) module"] pub type R4NONCER1 = crate::Reg<u32, _R4NONCER1>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R4NONCER1; #[doc = "`read()` method returns [r4noncer1::R](r4noncer1::R) reader structure"] impl crate::Readable for R4NONCER1 {} #[doc = "`write(|w| ..)` method takes [r4noncer1::W](r4noncer1::W) writer structure"] impl crate::Writable for R4NONCER1 {} #[doc = "OTFDEC region x nonce register 1"] pub mod r4noncer1; #[doc = "OTFDEC region x key register 0\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r1keyr0](r1keyr0) module"] pub type R1KEYR0 = crate::Reg<u32, _R1KEYR0>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R1KEYR0; #[doc = "`write(|w| ..)` method takes [r1keyr0::W](r1keyr0::W) writer structure"] impl crate::Writable for R1KEYR0 {} #[doc = "OTFDEC region x key register 0"] pub mod r1keyr0; #[doc = "OTFDEC region x key register 0\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r2keyr0](r2keyr0) module"] pub type R2KEYR0 = crate::Reg<u32, _R2KEYR0>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R2KEYR0; #[doc = "`write(|w| ..)` method takes [r2keyr0::W](r2keyr0::W) writer structure"] impl crate::Writable for R2KEYR0 {} #[doc = "OTFDEC region x key register 0"] pub mod r2keyr0; #[doc = "OTFDEC region x key register 0\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r3keyr0](r3keyr0) module"] pub type R3KEYR0 = crate::Reg<u32, _R3KEYR0>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R3KEYR0; #[doc = "`write(|w| ..)` method takes [r3keyr0::W](r3keyr0::W) writer structure"] impl crate::Writable for R3KEYR0 {} #[doc = "OTFDEC region x key register 0"] pub mod r3keyr0; #[doc = "OTFDEC region x key register 0\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r4keyr0](r4keyr0) module"] pub type R4KEYR0 = crate::Reg<u32, _R4KEYR0>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R4KEYR0; #[doc = "`write(|w| ..)` method takes [r4keyr0::W](r4keyr0::W) writer structure"] impl crate::Writable for R4KEYR0 {} #[doc = "OTFDEC region x key register 0"] pub mod r4keyr0; #[doc = "OTFDEC region x key register 1\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r1keyr1](r1keyr1) module"] pub type R1KEYR1 = crate::Reg<u32, _R1KEYR1>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R1KEYR1; #[doc = "`write(|w| ..)` method takes [r1keyr1::W](r1keyr1::W) writer structure"] impl crate::Writable for R1KEYR1 {} #[doc = "OTFDEC region x key register 1"] pub mod r1keyr1; #[doc = "OTFDEC region x key register 1\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r2keyr1](r2keyr1) module"] pub type R2KEYR1 = crate::Reg<u32, _R2KEYR1>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R2KEYR1; #[doc = "`write(|w| ..)` method takes [r2keyr1::W](r2keyr1::W) writer structure"] impl crate::Writable for R2KEYR1 {} #[doc = "OTFDEC region x key register 1"] pub mod r2keyr1; #[doc = "OTFDEC region x key register 1\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r3keyr1](r3keyr1) module"] pub type R3KEYR1 = crate::Reg<u32, _R3KEYR1>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R3KEYR1; #[doc = "`write(|w| ..)` method takes [r3keyr1::W](r3keyr1::W) writer structure"] impl crate::Writable for R3KEYR1 {} #[doc = "OTFDEC region x key register 1"] pub mod r3keyr1; #[doc = "OTFDEC region x key register 1\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r4keyr1](r4keyr1) module"] pub type R4KEYR1 = crate::Reg<u32, _R4KEYR1>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R4KEYR1; #[doc = "`write(|w| ..)` method takes [r4keyr1::W](r4keyr1::W) writer structure"] impl crate::Writable for R4KEYR1 {} #[doc = "OTFDEC region x key register 1"] pub mod r4keyr1; #[doc = "OTFDEC region x key register 2\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r1keyr2](r1keyr2) module"] pub type R1KEYR2 = crate::Reg<u32, _R1KEYR2>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R1KEYR2; #[doc = "`write(|w| ..)` method takes [r1keyr2::W](r1keyr2::W) writer structure"] impl crate::Writable for R1KEYR2 {} #[doc = "OTFDEC region x key register 2"] pub mod r1keyr2; #[doc = "OTFDEC region x key register 2\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r2keyr2](r2keyr2) module"] pub type R2KEYR2 = crate::Reg<u32, _R2KEYR2>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R2KEYR2; #[doc = "`write(|w| ..)` method takes [r2keyr2::W](r2keyr2::W) writer structure"] impl crate::Writable for R2KEYR2 {} #[doc = "OTFDEC region x key register 2"] pub mod r2keyr2; #[doc = "OTFDEC region x key register 2\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r3keyr2](r3keyr2) module"] pub type R3KEYR2 = crate::Reg<u32, _R3KEYR2>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R3KEYR2; #[doc = "`write(|w| ..)` method takes [r3keyr2::W](r3keyr2::W) writer structure"] impl crate::Writable for R3KEYR2 {} #[doc = "OTFDEC region x key register 2"] pub mod r3keyr2; #[doc = "OTFDEC region x key register 2\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r4keyr2](r4keyr2) module"] pub type R4KEYR2 = crate::Reg<u32, _R4KEYR2>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R4KEYR2; #[doc = "`write(|w| ..)` method takes [r4keyr2::W](r4keyr2::W) writer structure"] impl crate::Writable for R4KEYR2 {} #[doc = "OTFDEC region x key register 2"] pub mod r4keyr2; #[doc = "OTFDEC region x key register 3\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r1keyr3](r1keyr3) module"] pub type R1KEYR3 = crate::Reg<u32, _R1KEYR3>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R1KEYR3; #[doc = "`write(|w| ..)` method takes [r1keyr3::W](r1keyr3::W) writer structure"] impl crate::Writable for R1KEYR3 {} #[doc = "OTFDEC region x key register 3"] pub mod r1keyr3; #[doc = "OTFDEC region x key register 3\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r2keyr3](r2keyr3) module"] pub type R2KEYR3 = crate::Reg<u32, _R2KEYR3>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R2KEYR3; #[doc = "`write(|w| ..)` method takes [r2keyr3::W](r2keyr3::W) writer structure"] impl crate::Writable for R2KEYR3 {} #[doc = "OTFDEC region x key register 3"] pub mod r2keyr3; #[doc = "OTFDEC region x key register 3\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r3keyr3](r3keyr3) module"] pub type R3KEYR3 = crate::Reg<u32, _R3KEYR3>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R3KEYR3; #[doc = "`write(|w| ..)` method takes [r3keyr3::W](r3keyr3::W) writer structure"] impl crate::Writable for R3KEYR3 {} #[doc = "OTFDEC region x key register 3"] pub mod r3keyr3; #[doc = "OTFDEC region x key register 3\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [r4keyr3](r4keyr3) module"] pub type R4KEYR3 = crate::Reg<u32, _R4KEYR3>; #[allow(missing_docs)] #[doc(hidden)] pub struct _R4KEYR3; #[doc = "`write(|w| ..)` method takes [r4keyr3::W](r4keyr3::W) writer structure"] impl crate::Writable for R4KEYR3 {} #[doc = "OTFDEC region x key register 3"] pub mod r4keyr3; #[doc = "OTFDEC interrupt status register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [isr](isr) module"] pub type ISR = crate::Reg<u32, _ISR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _ISR; #[doc = "`read()` method returns [isr::R](isr::R) reader structure"] impl crate::Readable for ISR {} #[doc = "OTFDEC interrupt status register"] pub mod isr; #[doc = "OTFDEC interrupt clear register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [icr](icr) module"] pub type ICR = crate::Reg<u32, _ICR>; #[allow(missing_docs)] #[doc(hidden)] pub struct _ICR; #[doc = "`read()` method returns [icr::R](icr::R) reader structure"] impl crate::Readable for ICR {} #[doc = "OTFDEC interrupt clear register"] pub mod icr; #[doc = "OTFDEC interrupt enable register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ier](ier) module"] pub type IER = crate::Reg<u32, _IER>; #[allow(missing_docs)] #[doc(hidden)] pub struct _IER; #[doc = "`read()` method returns [ier::R](ier::R) reader structure"] impl crate::Readable for IER {} #[doc = "`write(|w| ..)` method takes [ier::W](ier::W) writer structure"] impl crate::Writable for IER {} #[doc = "OTFDEC interrupt enable register"] pub mod ier;
use std::net::{TcpListener, TcpStream}; use std::thread; use std::io::Write; use std::time::Duration; fn handle_client(mut stream: TcpStream) { loop { stream.write("testtest\n".as_ref()); let sec = Duration::new(1,0); thread::sleep(sec); } } fn main() { let listener = TcpListener::bind("127.0.0.1:8888").unwrap(); for stream in listener.incoming() { match stream { Ok(stream) => { thread::spawn(move || { handle_client(stream) }); }, Err(e) => { println!("{}", e) }, } } drop(listener); }
#[allow(dead_code)] #[derive(Debug)] pub enum Message { Tick, LoadProject, LoadProjectChange(String), // save asset, etc }
#[macro_use] extern crate criterion; extern crate geo; use criterion::Criterion; use geo::prelude::*; use geo::{LineString, Polygon}; fn criterion_benchmark(c: &mut Criterion) { c.bench_function("extremes f32", |bencher| { let points = include!("../src/algorithm/test_fixtures/norway_main.rs"); let polygon = Polygon::new(LineString::<f32>::from(points), vec![]); bencher.iter(|| { polygon.extreme_points(); }); }); c.bench_function("extremes f64", |bencher| { let points = include!("../src/algorithm/test_fixtures/norway_main.rs"); let polygon = Polygon::new(LineString::<f32>::from(points), vec![]); bencher.iter(|| { polygon.extreme_points(); }); }); } criterion_group!(benches, criterion_benchmark); criterion_main!(benches);
//! Prints the definition and manipulation of choices. use crate::ir::{self, SetRef}; use crate::print; use proc_macro2::{Ident, Span, TokenStream}; use quote::{quote, ToTokens}; use serde::Serialize; /// Prints the ids of the variables of a `ChoiceInstance`. pub fn ids(choice_instance: &ir::ChoiceInstance, ctx: &print::Context) -> TokenStream { let choice = ctx.ir_desc.get_choice(&choice_instance.choice); let arg_sets = choice.arguments().sets(); let ids = choice_instance .vars .iter() .zip_eq(arg_sets) .map(|(&var, set)| { // TODO(cleanup): use idents instead of variables in the context. let var = Ident::new(&ctx.var_name(var).to_string(), Span::call_site()); print::set::ObjectId::from_object(&var.into(), set.def()) }); quote!(#(#ids,)*) } /// Restricts a choice to `value`. If `delayed` is true, actions are put in the /// `actions` vector instead of being directly applied. pub fn restrict( choice_instance: &ir::ChoiceInstance, value: &print::Value, delayed: bool, ctx: &print::Context, ) -> TokenStream { assert_eq!( &choice_instance.value_type(ctx.ir_desc).full_type(), value.value_type() ); // TODO(span): keep the real span. let name = Ident::new(&choice_instance.choice, Span::call_site()); let ids = ids(choice_instance, ctx); if delayed { quote!(actions.extend(#name::restrict_delayed(#ids ir_instance, store, #value)?);) } else { quote!(#name::restrict(#ids ir_instance, store, #value, diff)?;) } } // TODO(cleanup): use TokenStream insted of templates use crate::ir::Adaptable; use crate::print::{ast, filter, value_set}; use itertools::Itertools; #[derive(Serialize)] pub struct Ast<'a> { /// The name of the choice. name: &'a str, /// The documentation attached to the choice. doc: Option<&'a str>, /// The arguments for wich the choice is instantiated. arguments: Vec<(&'a str, ast::Set<'a>)>, /// The type of the values the choice can take. value_type: ast::ValueType, /// The type of the full value corresponding to 'value_type' full_value_type: ast::ValueType, /// The definition of the choice. choice_def: ChoiceDef, /// Indicates if hte choice is symmetric. is_symmetric: bool, /// Indicates if hte choice is antisymmetric. is_antisymmetric: bool, /// AST of the triggers. trigger_calls: Vec<TriggerCall<'a>>, /// Loop nest that iterates over the arguments of the choice. iteration_space: ast::LoopNest<'a>, /// AST of the restrict function on counters. restrict_counter: Option<RestrictCounter<'a>>, /// Actions to perform when the choice value is modified. on_change: Vec<OnChangeAction<'a>>, /// Actions to perform when initializing counters. filter_actions: Vec<FilterAction<'a>>, /// Ast for filters. filters: Vec<filter::Filter<'a>>, /// Compute Counter function AST. compute_counter: Option<ComputeCounter<'a>>, } impl<'a> Ast<'a> { pub fn new(choice: &'a ir::Choice, ir_desc: &'a ir::IrDesc) -> Self { let (is_symmetric, is_antisymmetric) = match *choice.arguments() { ir::ChoiceArguments::Plain { .. } => (false, false), ir::ChoiceArguments::Symmetric { inverse, .. } => (true, inverse), }; let filter_actions = choice .filter_actions() .map(move |action| FilterAction::new(action, choice, ir_desc)) .collect(); let mut trigger_calls = Vec::new(); let on_change = choice .on_change() .map(|action| { OnChangeAction::new(action, choice, ir_desc, &mut trigger_calls) }) .collect(); let filters = choice .filters() .enumerate() .map(|(id, f)| filter::Filter::new(f, id, choice, ir_desc)) .collect(); let ctx = &ast::Context::new(ir_desc, choice, &[], &[]); let arguments = choice .arguments() .iter() .map(|(n, s)| (n as &str, ast::Set::new(s, ctx))) .collect(); Ast { name: choice.name(), doc: choice.doc(), value_type: ast::ValueType::new(choice.value_type(), ctx), full_value_type: ast::ValueType::new(choice.value_type().full_type(), ctx), choice_def: ChoiceDef::new(choice.choice_def()), restrict_counter: RestrictCounter::new(choice, ir_desc), iteration_space: self::iteration_space(choice, ctx), compute_counter: ComputeCounter::new(choice, ir_desc), arguments, trigger_calls, is_symmetric, is_antisymmetric, on_change, filter_actions, filters, } } pub fn name(&self) -> &str { self.name } } /// Returns the iteration space associated to `choice`. fn iteration_space<'a>(choice: &ir::Choice, ctx: &ast::Context<'a>) -> ast::LoopNest<'a> { match *choice.arguments() { ref args @ ir::ChoiceArguments::Plain { .. } => { let args = (0..args.len()).map(ir::Variable::Arg); ast::LoopNest::new(args, ctx, &mut vec![], false) } ir::ChoiceArguments::Symmetric { .. } => { ast::LoopNest::triangular(ir::Variable::Arg(0), ir::Variable::Arg(1), ctx) } } } #[derive(Serialize)] enum ChoiceDef { Enum, Counter { kind: ir::CounterKind }, Integer, } impl ChoiceDef { fn new(def: &ir::ChoiceDef) -> Self { match *def { ir::ChoiceDef::Enum(..) => ChoiceDef::Enum, ir::ChoiceDef::Counter { kind, .. } => ChoiceDef::Counter { kind }, ir::ChoiceDef::Number { .. } => ChoiceDef::Integer, } } } #[derive(Serialize)] struct TriggerCall<'a> { id: usize, arguments: Vec<(ast::Variable<'a>, ast::Set<'a>)>, code: String, } /// An action to run at filter initialization. /// [template]: printed by the `filter_action` template. #[derive(Serialize)] struct FilterAction<'a> { constraints: Vec<ast::SetConstraint<'a>>, body: FilterCall<'a>, } impl<'a> FilterAction<'a> { fn new( action: &'a ir::FilterAction, choice: &'a ir::Choice, ir_desc: &'a ir::IrDesc, ) -> Self { let set = ast::Variable::with_name("values"); let forall_vars = &action.filter.forall_vars; let ctx = &ast::Context::new(ir_desc, choice, forall_vars, &[]); let conflicts = ast::Conflict::choice_args(choice, &ctx); let body = FilterCall::new(&action.filter, set, conflicts, 0, ctx); let constraints = ast::SetConstraint::new(&action.set_constraints, ctx); FilterAction { constraints, body } } } #[derive(Serialize)] struct ComputeCounter<'a> { base: String, half: bool, nest: ast::LoopNest<'a>, body: String, op: String, } impl<'a> ComputeCounter<'a> { fn new(choice: &'a ir::Choice, ir_desc: &'a ir::IrDesc) -> Option<Self> { use crate::ir::ChoiceDef::Counter; let def = choice.choice_def(); if let Counter { ref incr_iter, kind, ref value, ref incr, ref incr_condition, visibility, ref base, } = *def { let ctx = ast::Context::new(ir_desc, choice, incr_iter, &[]); let mut conflicts = ast::Conflict::choice_args(choice, &ctx); let forall_vars = (0..incr_iter.len()).map(ir::Variable::Forall); let nest_builder = ast::LoopNest::new(forall_vars, &ctx, &mut conflicts, false); let body = print::counter::compute_counter_body( value, incr, incr_condition, kind, visibility, &ctx, ); Some(ComputeCounter { base: ast::code(base, &ctx), half: visibility == ir::CounterVisibility::NoMax, nest: nest_builder, body: body.to_string(), op: kind.to_string(), }) } else { None } } } /// AST for an `OnChange` action. /// [template]: printed by the `on_change` template. #[derive(Serialize)] struct OnChangeAction<'a> { constraints: Vec<ast::SetConstraint<'a>>, loop_nest: ast::LoopNest<'a>, action: ChoiceAction<'a>, } impl<'a> OnChangeAction<'a> { /// Generates the AST for an action to perform when `choice` is restricted. fn new( action: &'a ir::OnChangeAction, choice: &'a ir::Choice, ir_desc: &'a ir::IrDesc, trigger_calls: &mut Vec<TriggerCall<'a>>, ) -> Self { // TODO(cc_perf): if the other is symmetric -> need to iterate only on part of it. // Setup the context and variable names. let forall_vars = action.forall_vars.iter().chain(action.action.variables()); let inputs = action.action.inputs(); let ctx = &ast::Context::new(ir_desc, choice, forall_vars, inputs); let mut conflicts = ast::Conflict::choice_args(choice, ctx); // Declare loop nests. let loop_nest = { let action_foralls = (0..action.forall_vars.len()).map(ir::Variable::Forall); ast::LoopNest::new(action_foralls, ctx, &mut conflicts, false) }; // Build the body. let constraints = ast::SetConstraint::new(&action.set_constraints, ctx); let forall_offset = action.forall_vars.len(); let action = ChoiceAction::new( &action.action, forall_offset, &action.set_constraints, conflicts, ctx, choice, trigger_calls, ); OnChangeAction { constraints, loop_nest, action, } } } /// Ast for an `ir::ChoiceAction`. #[derive(Serialize)] enum ChoiceAction<'a> { FilterSelf, FilterRemote(RemoteFilterCall<'a>), IncrCounter { counter_name: &'a str, arguments: Vec<(ast::Variable<'a>, ast::Set<'a>)>, incr_condition: String, value_getter: String, counter_type: ast::ValueType, is_half: bool, zero: u32, min: String, max: String, }, UpdateCounter { name: &'a str, incr_name: &'a str, incr_args: Vec<(ast::Variable<'a>, ast::Set<'a>)>, incr_condition: String, arguments: Vec<(ast::Variable<'a>, ast::Set<'a>)>, counter_type: ast::ValueType, incr_type: ast::ValueType, is_half: bool, zero: u32, }, Trigger { call_id: usize, arguments: Vec<(ast::Variable<'a>, ast::Set<'a>)>, inputs: Vec<(ast::Variable<'a>, ast::ChoiceInstance<'a>)>, others_conditions: Vec<String>, self_condition: String, }, } /// Prints an action performed by a choice. impl<'a> ChoiceAction<'a> { fn new( action: &'a ir::ChoiceAction, forall_offset: usize, set_constraints: &'a ir::SetConstraints, conflicts: Vec<ast::Conflict<'a>>, ctx: &ast::Context<'a>, current_choice: &ir::Choice, trigger_calls: &mut Vec<TriggerCall<'a>>, ) -> Self { match action { ir::ChoiceAction::FilterSelf => ChoiceAction::FilterSelf, ir::ChoiceAction::RemoteFilter(remote_call) => { let call = RemoteFilterCall::new(remote_call, conflicts, forall_offset, ctx); ChoiceAction::FilterRemote(call) } ir::ChoiceAction::IncrCounter { counter, value, incr_condition, } => { let counter_choice = ctx.ir_desc.get_choice(&counter.choice); let counter_def = counter_choice.choice_def(); let arguments = ast::vars_with_sets(counter_choice, &counter.vars, ctx); let adaptator = ir::Adaptator::from_arguments(&counter.vars); let counter_type = counter_def.value_type().adapt(&adaptator); let value_getter = print::counter::increment_amount(value, true, ctx); let value: print::Value = value_getter.create_ident("value").into(); let min = value.get_min(ctx); let max = value.get_max(ctx); if let ir::ChoiceDef::Counter { kind, visibility, .. } = *counter_def { ChoiceAction::IncrCounter { counter_name: &counter.choice, incr_condition: value_set::print(incr_condition, ctx).to_string(), counter_type: ast::ValueType::new(counter_type, ctx), arguments, value_getter: value_getter.into_token_stream().to_string(), is_half: visibility == ir::CounterVisibility::NoMax, zero: kind.zero(), min: min.into_token_stream().to_string(), max: max.into_token_stream().to_string(), } } else { panic!() } } ir::ChoiceAction::UpdateCounter { counter, incr, incr_condition, } => { let counter_choice = ctx.ir_desc.get_choice(&counter.choice); let counter_def = counter_choice.choice_def(); let incr_choice = ctx.ir_desc.get_choice(&incr.choice); let arguments = ast::vars_with_sets(counter_choice, &counter.vars, ctx); let incr_args = ast::vars_with_sets(incr_choice, &incr.vars, ctx); let adaptator = ir::Adaptator::from_arguments(&counter.vars); let counter_type = counter_def.value_type().adapt(&adaptator); if let ir::ChoiceDef::Counter { kind, visibility, .. } = *counter_def { ChoiceAction::UpdateCounter { name: &counter.choice, incr_name: &incr.choice, incr_condition: value_set::print(incr_condition, ctx).to_string(), is_half: visibility == ir::CounterVisibility::NoMax, zero: kind.zero(), counter_type: ast::ValueType::new(counter_type, ctx), incr_type: ast::ValueType::new(current_choice.value_type(), ctx), incr_args, arguments, } } else { panic!() } } ir::ChoiceAction::Trigger { id, condition, code, inverse_self_cond, } => { let others_conditions = condition .others_conditions .iter() .map(|c| filter::condition(c, ctx).to_string()) .collect(); let inputs = condition .inputs .iter() .enumerate() .map(|(pos, input)| { (ctx.input_name(pos), ast::ChoiceInstance::new(input, ctx)) }) .collect(); let arguments = (0..current_choice.arguments().len()) .map(ir::Variable::Arg) .chain((0..forall_offset).map(ir::Variable::Forall)) .map(|v| { let (name, set) = ctx.var_def(v); ( name, ast::Set::new( set_constraints.find_set(v).unwrap_or(set), ctx, ), ) }) .collect_vec(); let code = ast::code(code, ctx); let call_id = trigger_calls.len(); let mut self_condition = condition.self_condition.clone(); if *inverse_self_cond { self_condition.inverse(ctx.ir_desc); } let call = TriggerCall { id: *id, code, arguments: arguments.clone(), }; trigger_calls.push(call); ChoiceAction::Trigger { call_id, others_conditions, inputs, arguments, self_condition: value_set::print(&self_condition, ctx).to_string(), } } } } } /// AST for an `ir::RemoteFilterCall`. #[derive(Serialize)] pub struct RemoteFilterCall<'a> { choice: &'a str, is_symmetric: bool, filter_call: FilterCall<'a>, choice_full_type: ast::ValueType, arguments: Vec<(ast::Variable<'a>, ast::Set<'a>)>, } impl<'a> RemoteFilterCall<'a> { pub fn new( remote_call: &'a ir::RemoteFilterCall, conflicts: Vec<ast::Conflict<'a>>, forall_offset: usize, ctx: &ast::Context<'a>, ) -> Self { let set = ast::Variable::with_name("values"); let choice = ctx.ir_desc.get_choice(&remote_call.choice.choice); let filter_call = FilterCall::new(&remote_call.filter, set, conflicts, forall_offset, ctx); let arguments = ast::vars_with_sets(choice, &remote_call.choice.vars, ctx); let adaptator = ir::Adaptator::from_arguments(&remote_call.choice.vars); let full_type = choice.value_type().full_type().adapt(&adaptator); RemoteFilterCall { is_symmetric: choice.arguments().is_symmetric(), choice: choice.name(), choice_full_type: ast::ValueType::new(full_type, ctx), filter_call, arguments, } } } /// AST for an `ir::FilterCall`. #[derive(Serialize)] struct FilterCall<'a> { loop_nest: ast::LoopNest<'a>, filter_ref: FilterRef<'a>, } impl<'a> FilterCall<'a> { fn new( filter_call: &'a ir::FilterCall, value_var: ast::Variable<'a>, mut conflicts: Vec<ast::Conflict<'a>>, forall_offset: usize, ctx: &ast::Context<'a>, ) -> Self { let num_foralls = filter_call.forall_vars.len(); let foralls = (0..num_foralls).map(|i| ir::Variable::Forall(i + forall_offset)); let filter_ref = FilterRef::new(&filter_call.filter_ref, value_var.clone(), ctx); let loop_nest = ast::LoopNest::new(foralls, ctx, &mut conflicts, false); FilterCall { loop_nest, filter_ref, } } } /// AST for an `ir::FilterRef`. #[derive(Serialize)] enum FilterRef<'a> { Inline { rules: Vec<filter::Rule<'a>>, }, Call { choice: &'a str, id: usize, arguments: Vec<(ast::Variable<'a>,)>, value_var: ast::Variable<'a>, }, } impl<'a> FilterRef<'a> { fn new( filter_ref: &'a ir::FilterRef, value_var: ast::Variable<'a>, ctx: &ast::Context<'a>, ) -> Self { match filter_ref { ir::FilterRef::Inline(rules) => { let rules = rules .iter() .map(|r| filter::Rule::new(value_var.clone(), r, ctx)) .collect(); FilterRef::Inline { rules } } ir::FilterRef::Function { choice, id, args } => { let arguments = args.iter().map(|&v| (ctx.var_name(v),)).collect(); FilterRef::Call { choice, id: *id, arguments, value_var, } } } } } #[derive(Serialize)] struct RestrictCounter<'a> { incr: ast::ChoiceInstance<'a>, incr_amount: String, incr_iter: ast::LoopNest<'a>, incr_type: ast::ValueType, incr_condition: String, is_half: bool, op: String, neg_op: &'static str, min: String, max: String, restrict_amount: String, restrict_amount_delayed: String, } impl<'a> RestrictCounter<'a> { fn new(choice: &'a ir::Choice, ir_desc: &'a ir::IrDesc) -> Option<Self> { use crate::ir::ChoiceDef::Counter; let def = choice.choice_def(); if let Counter { ref incr_iter, kind, ref value, ref incr, ref incr_condition, visibility, .. } = *def { let ctx = ast::Context::new(ir_desc, choice, incr_iter, &[]); let mut conflicts = ast::Conflict::choice_args(choice, &ctx); let forall_vars = (0..incr_iter.len()).map(ir::Variable::Forall); let incr_iter = ast::LoopNest::new(forall_vars, &ctx, &mut conflicts, false); let incr = ast::ChoiceInstance::new(incr, &ctx); let incr_amount_getter = print::counter::increment_amount(value, false, &ctx); let incr_amount: print::Value = incr_amount_getter.create_ident("incr_amount").into(); let min_incr_amount = incr_amount.get_min(&ctx); let max_incr_amount = incr_amount.get_max(&ctx); let restrict_amount = if let ir::CounterVal::Choice(choice) = value { Some(print::counter::restrict_incr_amount( choice, &incr_amount, kind, false, &ctx, )) } else { None }; let restrict_amount_delayed = if let ir::CounterVal::Choice(choice) = value { Some(print::counter::restrict_incr_amount( choice, &incr_amount, kind, true, &ctx, )) } else { None }; Some(RestrictCounter { incr, incr_iter, incr_amount: incr_amount_getter.into_token_stream().to_string(), incr_type: ast::ValueType::new(incr_condition.t(), &ctx), incr_condition: value_set::print(&incr_condition, &ctx).to_string(), is_half: visibility == ir::CounterVisibility::NoMax, op: kind.to_string(), neg_op: match kind { ir::CounterKind::Add => "-", ir::CounterKind::Mul => "/", }, min: min_incr_amount.into_token_stream().to_string(), max: max_incr_amount.into_token_stream().to_string(), restrict_amount: restrict_amount.into_token_stream().to_string(), restrict_amount_delayed: restrict_amount_delayed .into_token_stream() .to_string(), }) } else { None } } }
use isocountry::CountryCode; use serde::{Deserialize, Serialize}; use std::{ convert::TryInto, fmt::{self}, hash::{Hash, Hasher}, }; use crate::Error; #[cfg(feature = "cli")] use reqwest::{Client, Url}; use crate::{ apistringtype_from_display, format_string, latitude::Latitude, longitude::Longitude, weather_data::WeatherData, weather_forecast::WeatherForecast, ApiStringType, StringType, }; /// `WeatherApi` contains a `reqwest` Client and all the metadata required to /// query the openweathermap.org api. #[cfg(feature = "cli")] #[derive(Default, Clone)] pub struct WeatherApi { client: Client, api_key: ApiStringType, api_endpoint: StringType, api_path: StringType, geo_path: StringType, } #[derive(Clone, Debug, PartialEq, Hash, Eq)] pub enum WeatherLocation { ZipCode { zipcode: u64, country_code: Option<CountryCode>, }, CityName(StringType), LatLon { latitude: Latitude, longitude: Longitude, }, } #[cfg(feature = "cli")] impl Default for WeatherLocation { fn default() -> Self { Self::ZipCode { zipcode: 10001, country_code: None, } } } impl fmt::Display for WeatherLocation { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::ZipCode { zipcode, country_code: None, } => { write!(f, "{zipcode}") } Self::ZipCode { zipcode, country_code: Some(country_code), } => { write!(f, "{zipcode} {}", country_code.alpha2()) } Self::CityName(name) => { write!(f, "{name}") } Self::LatLon { latitude, longitude, } => { write!(f, "{latitude},{longitude}") } } } } impl WeatherLocation { #[inline] #[must_use] pub fn from_zipcode(zipcode: u64) -> Self { Self::ZipCode { zipcode, country_code: None, } } #[must_use] pub fn from_zipcode_country_code(zipcode: u64, country_code: CountryCode) -> Self { Self::ZipCode { zipcode, country_code: Some(country_code), } } #[must_use] pub fn from_zipcode_country_code_str(zipcode: u64, country_code: &str) -> Self { let country_code = CountryCode::for_alpha2(country_code).ok(); Self::ZipCode { zipcode, country_code, } } #[must_use] pub fn from_city_name(city_name: &str) -> Self { Self::CityName(city_name.into()) } #[must_use] pub fn from_lat_lon(latitude: Latitude, longitude: Longitude) -> Self { Self::LatLon { latitude, longitude, } } #[must_use] pub fn get_options(&self) -> Vec<(&'static str, ApiStringType)> { match self { Self::ZipCode { zipcode, country_code, } => { let country_code = country_code.map_or("US", |c| c.alpha2()); let zipcode_str = apistringtype_from_display(zipcode); vec![("zip", zipcode_str), ("country_code", country_code.into())] } Self::CityName(city_name) => { let city_name = city_name.into(); vec![("q", city_name)] } Self::LatLon { latitude, longitude, } => { let latitude_str = apistringtype_from_display(latitude); let longitude_str = apistringtype_from_display(longitude); vec![("lat", latitude_str), ("lon", longitude_str)] } } } /// Convert `WeatherLocation` to latitude/longitude /// # Errors /// /// Will return error if `WeatherApi::run_geo` fails #[cfg(feature = "cli")] pub async fn to_lat_lon(&self, api: &WeatherApi) -> Result<Self, Error> { match self { Self::CityName(city_name) => { let result = api.get_direct_location(city_name).await?; if let Some(loc) = result.get(0) { Ok(Self::LatLon { latitude: loc.lat.try_into()?, longitude: loc.lon.try_into()?, }) } else { Err(Error::InvalidValue("no results returned".into())) } } Self::ZipCode { zipcode, country_code, } => { let loc = api.get_zip_location(*zipcode, *country_code).await?; Ok(Self::LatLon { latitude: loc.lat.try_into()?, longitude: loc.lon.try_into()?, }) } lat_lon @ Self::LatLon { .. } => Ok(lat_lon.clone()), } } } #[cfg(feature = "cli")] impl PartialEq for WeatherApi { fn eq(&self, other: &Self) -> bool { self.api_key == other.api_key && self.api_endpoint == other.api_endpoint && self.api_path == other.api_path } } #[cfg(feature = "cli")] impl fmt::Debug for WeatherApi { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let api_key = &self.api_key; let api_endpoint = &self.api_endpoint; write!(f, "WeatherApi(key={api_key},endpoint={api_endpoint})") } } #[cfg(feature = "cli")] impl Hash for WeatherApi { fn hash<H: Hasher>(&self, state: &mut H) { format!("{self:?}").hash(state); } } #[derive(Clone, Copy)] enum WeatherCommands { Weather, Forecast, } impl WeatherCommands { fn to_str(self) -> &'static str { match self { Self::Weather => "weather", Self::Forecast => "forecast", } } } impl fmt::Display for WeatherCommands { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.to_str()) } } #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)] pub struct GeoLocation { pub name: StringType, pub lat: f64, pub lon: f64, pub country: StringType, pub zip: Option<StringType>, } #[cfg(feature = "cli")] impl WeatherApi { /// Create `WeatherApi` instance specifying `api_key`, `api_endpoint` and /// `api_path` #[must_use] pub fn new(api_key: &str, api_endpoint: &str, api_path: &str, geo_path: &str) -> Self { Self { client: Client::new(), api_key: api_key.into(), api_endpoint: api_endpoint.into(), api_path: api_path.into(), geo_path: geo_path.into(), } } #[must_use] pub fn with_key(self, api_key: &str) -> Self { Self { api_key: api_key.into(), ..self } } #[must_use] pub fn with_endpoint(self, api_endpoint: &str) -> Self { Self { api_endpoint: api_endpoint.into(), ..self } } #[must_use] pub fn with_path(self, api_path: &str) -> Self { Self { api_path: api_path.into(), ..self } } #[must_use] pub fn with_geo(self, geo_path: &str) -> Self { Self { geo_path: geo_path.into(), ..self } } /// Get `WeatherData` from api /// # Errors /// /// Will return error if `WeatherApi::run_api` fails pub async fn get_weather_data(&self, location: &WeatherLocation) -> Result<WeatherData, Error> { let options = self.get_options(location); self.run_api(WeatherCommands::Weather, &options).await } /// Get `WeatherForecast` from api /// # Errors /// /// Will return error if `WeatherApi::run_api` fails pub async fn get_weather_forecast( &self, location: &WeatherLocation, ) -> Result<WeatherForecast, Error> { let options = self.get_options(location); self.run_api(WeatherCommands::Forecast, &options).await } fn get_options(&self, location: &WeatherLocation) -> Vec<(&'static str, ApiStringType)> { let mut options = location.get_options(); options.push(("appid", self.api_key.clone())); options } async fn run_api<T: serde::de::DeserializeOwned>( &self, command: WeatherCommands, options: &[(&'static str, ApiStringType)], ) -> Result<T, Error> { let api_endpoint = &self.api_endpoint; let api_path = &self.api_path; let command = format_string!("{command}"); self._run_api(&command, options, api_endpoint, api_path) .await } /// Get `GeoLocation`'s from api /// # Errors /// /// Will return error if `WeatherApi::run_geo` fails pub async fn get_direct_location(&self, q: &str) -> Result<Vec<GeoLocation>, Error> { let options = vec![("appid", self.api_key.clone()), ("q", q.into())]; self.run_geo("direct", &options).await } /// Get `GeoLocation`'s from api /// # Errors /// /// Will return error if `WeatherApi::run_geo` fails pub async fn get_geo_location( &self, lat: Latitude, lon: Longitude, ) -> Result<Vec<GeoLocation>, Error> { let options = vec![ ("appid", self.api_key.clone()), ("lat", format_string!("{lat}").into()), ("lon", format_string!("{lon}").into()), ]; self.run_geo("reverse", &options).await } /// Get `GeoLocation`'s from api /// # Errors /// /// Will return error if `WeatherApi::run_geo` fails pub async fn get_zip_location( &self, zipcode: u64, country_code: Option<CountryCode>, ) -> Result<GeoLocation, Error> { let mut options = vec![("appid", self.api_key.clone())]; if let Some(country_code) = &country_code { options.push(( "zip", format_string!("{zipcode},{}", country_code.alpha2()).into(), )); } else { options.push(("zip", format_string!("{zipcode},US").into())); } self.run_geo("zip", &options).await } async fn run_geo<T: serde::de::DeserializeOwned>( &self, command: &str, options: &[(&'static str, ApiStringType)], ) -> Result<T, Error> { let api_endpoint = &self.api_endpoint; let api_path = &self.geo_path; self._run_api(command, options, api_endpoint, api_path) .await } async fn _run_api<T: serde::de::DeserializeOwned>( &self, command: &str, options: &[(&'static str, ApiStringType)], api_endpoint: &str, api_path: &str, ) -> Result<T, Error> { let base_url = format!("https://{api_endpoint}/{api_path}{command}"); let url = Url::parse_with_params(&base_url, options)?; self.client .get(url) .send() .await? .error_for_status()? .json() .await .map_err(Into::into) } } #[cfg(test)] mod tests { use futures::future::join; use isocountry::CountryCode; use log::info; use std::{ collections::hash_map::DefaultHasher, convert::TryInto, hash::{Hash, Hasher}, }; use crate::{weather_api::WeatherLocation, ApiStringType, Error}; #[cfg(feature = "cli")] use crate::weather_api::WeatherApi; #[cfg(feature = "cli")] #[tokio::test] async fn test_geo_location() -> Result<(), Error> { let api_key = "95337ed3a8a87acae620d673fae85b11"; let api_endpoint = "api.openweathermap.org"; let api_path = "data/2.5/"; let geo_path = "geo/1.0/"; let api = WeatherApi::new(api_key, api_endpoint, api_path, geo_path); let loc = WeatherLocation::from_zipcode(11106); if let WeatherLocation::LatLon { latitude, longitude, } = loc.to_lat_lon(&api).await? { let lat: f64 = latitude.into(); let lon: f64 = longitude.into(); assert!((lat - 40.76080).abs() < 0.00001); assert!((lon - -73.92950).abs() < 0.00001); let locations = api.get_geo_location(latitude, longitude).await?; assert_eq!(locations.len(), 1); let location = &locations[0]; assert_eq!(&location.name, "New York County"); } else { assert!(false); } let loc = WeatherLocation::from_city_name("Astoria,NY,US"); if let WeatherLocation::LatLon { latitude, longitude, } = loc.to_lat_lon(&api).await? { let lat: f64 = latitude.into(); let lon: f64 = longitude.into(); assert!((lat - 40.772014).abs() < 0.00001); assert!((lon - -73.93026).abs() < 0.00001); } else { assert!(false); } Ok(()) } #[cfg(feature = "cli")] #[tokio::test] async fn test_process_opts() -> Result<(), Error> { let api_key = "95337ed3a8a87acae620d673fae85b11"; let api_endpoint = "api.openweathermap.org"; let api_path = "data/2.5/"; let geo_path = "geo/1.0/"; let api = WeatherApi::new(api_key, api_endpoint, api_path, geo_path); let loc = WeatherLocation::from_zipcode(11106); let mut hasher0 = DefaultHasher::new(); loc.hash(&mut hasher0); assert_eq!(hasher0.finish(), 3871895985647742457); let loc = loc.to_lat_lon(&api).await?; let (data, forecast) = join(api.get_weather_data(&loc), api.get_weather_forecast(&loc)).await; let (data, forecast) = (data?, forecast?); println!("{}", data.name); assert!(data.name == "Queensbridge Houses"); let timezone: i32 = forecast.city.timezone.into_inner(); info!("{}", timezone); info!("{:?}", forecast); assert!(timezone == -18000 || timezone == -14400); let loc = WeatherLocation::LatLon { latitude: 0.0.try_into()?, longitude: 0.0.try_into()?, }; let weather = api.get_weather_data(&loc).await?; assert_eq!(&weather.name, "Globe"); Ok(()) } #[test] fn test_weatherlocation_default() -> Result<(), Error> { assert_eq!( WeatherLocation::default(), WeatherLocation::from_zipcode(10001) ); Ok(()) } #[cfg(feature = "cli")] #[test] fn test_weatherapi() -> Result<(), Error> { let api = WeatherApi::new("8675309", "api.openweathermap.org", "data/2.5/", "geo/1.0/"); let api2 = WeatherApi::default() .with_key("8675309") .with_endpoint("api.openweathermap.org") .with_path("data/2.5/") .with_geo("geo/1.0/"); assert_eq!(api, api2); assert_eq!( format!("{api:?}"), "WeatherApi(key=8675309,endpoint=api.openweathermap.org)".to_string() ); let mut hasher0 = DefaultHasher::new(); api.hash(&mut hasher0); let mut hasher1 = DefaultHasher::new(); "WeatherApi(key=8675309,endpoint=api.openweathermap.org)" .to_string() .hash(&mut hasher1); info!("{:?}", api); assert_eq!(hasher0.finish(), hasher1.finish()); let loc = WeatherLocation::from_zipcode_country_code(10001, CountryCode::USA); let opts = api.get_options(&loc); let expected: Vec<(&str, ApiStringType)> = vec![ ("zip", "10001".into()), ("country_code", "US".into()), ("appid", "8675309".into()), ]; assert_eq!(opts, expected); let loc = WeatherLocation::from_city_name("New York"); let opts = api.get_options(&loc); let expected: Vec<(&str, ApiStringType)> = vec![("q", "New York".into()), ("appid", "8675309".into())]; assert_eq!(opts, expected); let loc = WeatherLocation::from_lat_lon(41.0f64.try_into()?, 39.0f64.try_into()?); let opts = api.get_options(&loc); let expected: Vec<(&str, ApiStringType)> = vec![ ("lat", "41.00000".into()), ("lon", "39.00000".into()), ("appid", "8675309".into()), ]; assert_eq!(opts, expected); Ok(()) } }
#[doc = "Reader of register MPCBB1_VCTR0"] pub type R = crate::R<u32, super::MPCBB1_VCTR0>; #[doc = "Writer for register MPCBB1_VCTR0"] pub type W = crate::W<u32, super::MPCBB1_VCTR0>; #[doc = "Register MPCBB1_VCTR0 `reset()`'s with value 0xffff_ffff"] impl crate::ResetValue for super::MPCBB1_VCTR0 { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0xffff_ffff } } #[doc = "Reader of field `B0`"] pub type B0_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B0`"] pub struct B0_W<'a> { w: &'a mut W, } impl<'a> B0_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 } } #[doc = "Reader of field `B1`"] pub type B1_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B1`"] pub struct B1_W<'a> { w: &'a mut W, } impl<'a> B1_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 `B2`"] pub type B2_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B2`"] pub struct B2_W<'a> { w: &'a mut W, } impl<'a> B2_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 `B3`"] pub type B3_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B3`"] pub struct B3_W<'a> { w: &'a mut W, } impl<'a> B3_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 `B4`"] pub type B4_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B4`"] pub struct B4_W<'a> { w: &'a mut W, } impl<'a> B4_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 `B5`"] pub type B5_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B5`"] pub struct B5_W<'a> { w: &'a mut W, } impl<'a> B5_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 `B6`"] pub type B6_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B6`"] pub struct B6_W<'a> { w: &'a mut W, } impl<'a> B6_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 `B7`"] pub type B7_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B7`"] pub struct B7_W<'a> { w: &'a mut W, } impl<'a> B7_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 `B8`"] pub type B8_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B8`"] pub struct B8_W<'a> { w: &'a mut W, } impl<'a> B8_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 `B9`"] pub type B9_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B9`"] pub struct B9_W<'a> { w: &'a mut W, } impl<'a> B9_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 `B10`"] pub type B10_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B10`"] pub struct B10_W<'a> { w: &'a mut W, } impl<'a> B10_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 << 10)) | (((value as u32) & 0x01) << 10); self.w } } #[doc = "Reader of field `B11`"] pub type B11_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B11`"] pub struct B11_W<'a> { w: &'a mut W, } impl<'a> B11_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 << 11)) | (((value as u32) & 0x01) << 11); self.w } } #[doc = "Reader of field `B12`"] pub type B12_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B12`"] pub struct B12_W<'a> { w: &'a mut W, } impl<'a> B12_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 << 12)) | (((value as u32) & 0x01) << 12); self.w } } #[doc = "Reader of field `B13`"] pub type B13_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B13`"] pub struct B13_W<'a> { w: &'a mut W, } impl<'a> B13_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 << 13)) | (((value as u32) & 0x01) << 13); self.w } } #[doc = "Reader of field `B14`"] pub type B14_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B14`"] pub struct B14_W<'a> { w: &'a mut W, } impl<'a> B14_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 << 14)) | (((value as u32) & 0x01) << 14); self.w } } #[doc = "Reader of field `B15`"] pub type B15_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B15`"] pub struct B15_W<'a> { w: &'a mut W, } impl<'a> B15_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 << 15)) | (((value as u32) & 0x01) << 15); self.w } } #[doc = "Reader of field `B16`"] pub type B16_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B16`"] pub struct B16_W<'a> { w: &'a mut W, } impl<'a> B16_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 << 16)) | (((value as u32) & 0x01) << 16); self.w } } #[doc = "Reader of field `B17`"] pub type B17_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B17`"] pub struct B17_W<'a> { w: &'a mut W, } impl<'a> B17_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 << 17)) | (((value as u32) & 0x01) << 17); self.w } } #[doc = "Reader of field `B18`"] pub type B18_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B18`"] pub struct B18_W<'a> { w: &'a mut W, } impl<'a> B18_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 << 18)) | (((value as u32) & 0x01) << 18); self.w } } #[doc = "Reader of field `B19`"] pub type B19_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B19`"] pub struct B19_W<'a> { w: &'a mut W, } impl<'a> B19_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 << 19)) | (((value as u32) & 0x01) << 19); self.w } } #[doc = "Reader of field `B20`"] pub type B20_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B20`"] pub struct B20_W<'a> { w: &'a mut W, } impl<'a> B20_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 << 20)) | (((value as u32) & 0x01) << 20); self.w } } #[doc = "Reader of field `B21`"] pub type B21_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B21`"] pub struct B21_W<'a> { w: &'a mut W, } impl<'a> B21_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 << 21)) | (((value as u32) & 0x01) << 21); self.w } } #[doc = "Reader of field `B22`"] pub type B22_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B22`"] pub struct B22_W<'a> { w: &'a mut W, } impl<'a> B22_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 << 22)) | (((value as u32) & 0x01) << 22); self.w } } #[doc = "Reader of field `B23`"] pub type B23_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B23`"] pub struct B23_W<'a> { w: &'a mut W, } impl<'a> B23_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 << 23)) | (((value as u32) & 0x01) << 23); self.w } } #[doc = "Reader of field `B24`"] pub type B24_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B24`"] pub struct B24_W<'a> { w: &'a mut W, } impl<'a> B24_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 << 24)) | (((value as u32) & 0x01) << 24); self.w } } #[doc = "Reader of field `B25`"] pub type B25_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B25`"] pub struct B25_W<'a> { w: &'a mut W, } impl<'a> B25_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 << 25)) | (((value as u32) & 0x01) << 25); self.w } } #[doc = "Reader of field `B26`"] pub type B26_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B26`"] pub struct B26_W<'a> { w: &'a mut W, } impl<'a> B26_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 << 26)) | (((value as u32) & 0x01) << 26); self.w } } #[doc = "Reader of field `B27`"] pub type B27_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B27`"] pub struct B27_W<'a> { w: &'a mut W, } impl<'a> B27_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 << 27)) | (((value as u32) & 0x01) << 27); self.w } } #[doc = "Reader of field `B28`"] pub type B28_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B28`"] pub struct B28_W<'a> { w: &'a mut W, } impl<'a> B28_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 << 28)) | (((value as u32) & 0x01) << 28); self.w } } #[doc = "Reader of field `B29`"] pub type B29_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B29`"] pub struct B29_W<'a> { w: &'a mut W, } impl<'a> B29_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 << 29)) | (((value as u32) & 0x01) << 29); self.w } } #[doc = "Reader of field `B30`"] pub type B30_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B30`"] pub struct B30_W<'a> { w: &'a mut W, } impl<'a> B30_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 << 30)) | (((value as u32) & 0x01) << 30); self.w } } #[doc = "Reader of field `B31`"] pub type B31_R = crate::R<bool, bool>; #[doc = "Write proxy for field `B31`"] pub struct B31_W<'a> { w: &'a mut W, } impl<'a> B31_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 << 31)) | (((value as u32) & 0x01) << 31); self.w } } impl R { #[doc = "Bit 0 - B0"] #[inline(always)] pub fn b0(&self) -> B0_R { B0_R::new((self.bits & 0x01) != 0) } #[doc = "Bit 1 - B1"] #[inline(always)] pub fn b1(&self) -> B1_R { B1_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - B2"] #[inline(always)] pub fn b2(&self) -> B2_R { B2_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 3 - B3"] #[inline(always)] pub fn b3(&self) -> B3_R { B3_R::new(((self.bits >> 3) & 0x01) != 0) } #[doc = "Bit 4 - B4"] #[inline(always)] pub fn b4(&self) -> B4_R { B4_R::new(((self.bits >> 4) & 0x01) != 0) } #[doc = "Bit 5 - B5"] #[inline(always)] pub fn b5(&self) -> B5_R { B5_R::new(((self.bits >> 5) & 0x01) != 0) } #[doc = "Bit 6 - B6"] #[inline(always)] pub fn b6(&self) -> B6_R { B6_R::new(((self.bits >> 6) & 0x01) != 0) } #[doc = "Bit 7 - B7"] #[inline(always)] pub fn b7(&self) -> B7_R { B7_R::new(((self.bits >> 7) & 0x01) != 0) } #[doc = "Bit 8 - B8"] #[inline(always)] pub fn b8(&self) -> B8_R { B8_R::new(((self.bits >> 8) & 0x01) != 0) } #[doc = "Bit 9 - B9"] #[inline(always)] pub fn b9(&self) -> B9_R { B9_R::new(((self.bits >> 9) & 0x01) != 0) } #[doc = "Bit 10 - B10"] #[inline(always)] pub fn b10(&self) -> B10_R { B10_R::new(((self.bits >> 10) & 0x01) != 0) } #[doc = "Bit 11 - B11"] #[inline(always)] pub fn b11(&self) -> B11_R { B11_R::new(((self.bits >> 11) & 0x01) != 0) } #[doc = "Bit 12 - B12"] #[inline(always)] pub fn b12(&self) -> B12_R { B12_R::new(((self.bits >> 12) & 0x01) != 0) } #[doc = "Bit 13 - B13"] #[inline(always)] pub fn b13(&self) -> B13_R { B13_R::new(((self.bits >> 13) & 0x01) != 0) } #[doc = "Bit 14 - B14"] #[inline(always)] pub fn b14(&self) -> B14_R { B14_R::new(((self.bits >> 14) & 0x01) != 0) } #[doc = "Bit 15 - B15"] #[inline(always)] pub fn b15(&self) -> B15_R { B15_R::new(((self.bits >> 15) & 0x01) != 0) } #[doc = "Bit 16 - B16"] #[inline(always)] pub fn b16(&self) -> B16_R { B16_R::new(((self.bits >> 16) & 0x01) != 0) } #[doc = "Bit 17 - B17"] #[inline(always)] pub fn b17(&self) -> B17_R { B17_R::new(((self.bits >> 17) & 0x01) != 0) } #[doc = "Bit 18 - B18"] #[inline(always)] pub fn b18(&self) -> B18_R { B18_R::new(((self.bits >> 18) & 0x01) != 0) } #[doc = "Bit 19 - B19"] #[inline(always)] pub fn b19(&self) -> B19_R { B19_R::new(((self.bits >> 19) & 0x01) != 0) } #[doc = "Bit 20 - B20"] #[inline(always)] pub fn b20(&self) -> B20_R { B20_R::new(((self.bits >> 20) & 0x01) != 0) } #[doc = "Bit 21 - B21"] #[inline(always)] pub fn b21(&self) -> B21_R { B21_R::new(((self.bits >> 21) & 0x01) != 0) } #[doc = "Bit 22 - B22"] #[inline(always)] pub fn b22(&self) -> B22_R { B22_R::new(((self.bits >> 22) & 0x01) != 0) } #[doc = "Bit 23 - B23"] #[inline(always)] pub fn b23(&self) -> B23_R { B23_R::new(((self.bits >> 23) & 0x01) != 0) } #[doc = "Bit 24 - B24"] #[inline(always)] pub fn b24(&self) -> B24_R { B24_R::new(((self.bits >> 24) & 0x01) != 0) } #[doc = "Bit 25 - B25"] #[inline(always)] pub fn b25(&self) -> B25_R { B25_R::new(((self.bits >> 25) & 0x01) != 0) } #[doc = "Bit 26 - B26"] #[inline(always)] pub fn b26(&self) -> B26_R { B26_R::new(((self.bits >> 26) & 0x01) != 0) } #[doc = "Bit 27 - B27"] #[inline(always)] pub fn b27(&self) -> B27_R { B27_R::new(((self.bits >> 27) & 0x01) != 0) } #[doc = "Bit 28 - B28"] #[inline(always)] pub fn b28(&self) -> B28_R { B28_R::new(((self.bits >> 28) & 0x01) != 0) } #[doc = "Bit 29 - B29"] #[inline(always)] pub fn b29(&self) -> B29_R { B29_R::new(((self.bits >> 29) & 0x01) != 0) } #[doc = "Bit 30 - B30"] #[inline(always)] pub fn b30(&self) -> B30_R { B30_R::new(((self.bits >> 30) & 0x01) != 0) } #[doc = "Bit 31 - B31"] #[inline(always)] pub fn b31(&self) -> B31_R { B31_R::new(((self.bits >> 31) & 0x01) != 0) } } impl W { #[doc = "Bit 0 - B0"] #[inline(always)] pub fn b0(&mut self) -> B0_W { B0_W { w: self } } #[doc = "Bit 1 - B1"] #[inline(always)] pub fn b1(&mut self) -> B1_W { B1_W { w: self } } #[doc = "Bit 2 - B2"] #[inline(always)] pub fn b2(&mut self) -> B2_W { B2_W { w: self } } #[doc = "Bit 3 - B3"] #[inline(always)] pub fn b3(&mut self) -> B3_W { B3_W { w: self } } #[doc = "Bit 4 - B4"] #[inline(always)] pub fn b4(&mut self) -> B4_W { B4_W { w: self } } #[doc = "Bit 5 - B5"] #[inline(always)] pub fn b5(&mut self) -> B5_W { B5_W { w: self } } #[doc = "Bit 6 - B6"] #[inline(always)] pub fn b6(&mut self) -> B6_W { B6_W { w: self } } #[doc = "Bit 7 - B7"] #[inline(always)] pub fn b7(&mut self) -> B7_W { B7_W { w: self } } #[doc = "Bit 8 - B8"] #[inline(always)] pub fn b8(&mut self) -> B8_W { B8_W { w: self } } #[doc = "Bit 9 - B9"] #[inline(always)] pub fn b9(&mut self) -> B9_W { B9_W { w: self } } #[doc = "Bit 10 - B10"] #[inline(always)] pub fn b10(&mut self) -> B10_W { B10_W { w: self } } #[doc = "Bit 11 - B11"] #[inline(always)] pub fn b11(&mut self) -> B11_W { B11_W { w: self } } #[doc = "Bit 12 - B12"] #[inline(always)] pub fn b12(&mut self) -> B12_W { B12_W { w: self } } #[doc = "Bit 13 - B13"] #[inline(always)] pub fn b13(&mut self) -> B13_W { B13_W { w: self } } #[doc = "Bit 14 - B14"] #[inline(always)] pub fn b14(&mut self) -> B14_W { B14_W { w: self } } #[doc = "Bit 15 - B15"] #[inline(always)] pub fn b15(&mut self) -> B15_W { B15_W { w: self } } #[doc = "Bit 16 - B16"] #[inline(always)] pub fn b16(&mut self) -> B16_W { B16_W { w: self } } #[doc = "Bit 17 - B17"] #[inline(always)] pub fn b17(&mut self) -> B17_W { B17_W { w: self } } #[doc = "Bit 18 - B18"] #[inline(always)] pub fn b18(&mut self) -> B18_W { B18_W { w: self } } #[doc = "Bit 19 - B19"] #[inline(always)] pub fn b19(&mut self) -> B19_W { B19_W { w: self } } #[doc = "Bit 20 - B20"] #[inline(always)] pub fn b20(&mut self) -> B20_W { B20_W { w: self } } #[doc = "Bit 21 - B21"] #[inline(always)] pub fn b21(&mut self) -> B21_W { B21_W { w: self } } #[doc = "Bit 22 - B22"] #[inline(always)] pub fn b22(&mut self) -> B22_W { B22_W { w: self } } #[doc = "Bit 23 - B23"] #[inline(always)] pub fn b23(&mut self) -> B23_W { B23_W { w: self } } #[doc = "Bit 24 - B24"] #[inline(always)] pub fn b24(&mut self) -> B24_W { B24_W { w: self } } #[doc = "Bit 25 - B25"] #[inline(always)] pub fn b25(&mut self) -> B25_W { B25_W { w: self } } #[doc = "Bit 26 - B26"] #[inline(always)] pub fn b26(&mut self) -> B26_W { B26_W { w: self } } #[doc = "Bit 27 - B27"] #[inline(always)] pub fn b27(&mut self) -> B27_W { B27_W { w: self } } #[doc = "Bit 28 - B28"] #[inline(always)] pub fn b28(&mut self) -> B28_W { B28_W { w: self } } #[doc = "Bit 29 - B29"] #[inline(always)] pub fn b29(&mut self) -> B29_W { B29_W { w: self } } #[doc = "Bit 30 - B30"] #[inline(always)] pub fn b30(&mut self) -> B30_W { B30_W { w: self } } #[doc = "Bit 31 - B31"] #[inline(always)] pub fn b31(&mut self) -> B31_W { B31_W { w: self } } }