screencapturekit/stream/configuration/
internal.rs1use std::ffi::c_void;
2use std::fmt;
3
4#[repr(transparent)]
19pub struct SCStreamConfiguration(pub(crate) *const c_void);
20
21impl PartialEq for SCStreamConfiguration {
22 fn eq(&self, other: &Self) -> bool {
23 self.0 == other.0
24 }
25}
26
27impl Eq for SCStreamConfiguration {}
28
29impl std::hash::Hash for SCStreamConfiguration {
30 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
31 self.0.hash(state);
32 }
33}
34
35impl SCStreamConfiguration {
36 pub(crate) fn internal_init() -> Self {
37 unsafe {
38 let ptr = crate::ffi::sc_stream_configuration_create();
39 Self(ptr)
40 }
41 }
42
43 pub(crate) fn as_ptr(&self) -> *const c_void {
44 self.0
45 }
46}
47
48crate::utils::retained::sc_retained!(
54 SCStreamConfiguration,
55 retain = crate::ffi::sc_stream_configuration_retain,
56 release = crate::ffi::sc_stream_configuration_release,
57);
58
59unsafe impl Send for SCStreamConfiguration {}
60unsafe impl Sync for SCStreamConfiguration {}
61
62impl fmt::Debug for SCStreamConfiguration {
63 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
64 f.debug_struct("SCStreamConfiguration")
65 .field("ptr", &self.0)
66 .finish()
67 }
68}
69
70impl fmt::Display for SCStreamConfiguration {
71 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
72 write!(f, "SCStreamConfiguration")
73 }
74}