JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

Giterated Stack `ObjectValue` and `Setting` refactor.

This refactor adds value and setting update events, as well as value getters. Additionally, the stack is now the owner of the ability to write settings into storage. This is accomplished with the `MetadataProvider` trait. This sets up the ground work for push federation, cache, and basically everything else. commit 7befc583cb3e0c6719506c550ed66ac76293413c Author: Amber <[email protected]> Date: Fri Sep 29 15:46:48 2023 -0500 Finish value and settings refactor in the stack. commit 3ac09994a0caafd1a0b95d9a781c7f202f20e75b Author: Amber <[email protected]> Date: Fri Sep 29 09:46:32 2023 -0500 Add set_setting handling back in commit 84fd31e3eae85d98fa68a28b333dbb32cde3bdb8 Author: Amber <[email protected]> Date: Wed Sep 27 06:36:31 2023 -0500 Remove some allocations from meta types commit 16c310ce3680c4a14ed35083b6a230aaecd43152 Author: Amber <[email protected]> Date: Wed Sep 27 05:35:03 2023 -0500 Add cargo metadata commit eb2520a20001bac7b21c6c3d34f62db32f0ada80 Author: Amber <[email protected]> Date: Wed Sep 27 05:26:27 2023 -0500 Refactor setting and value management to use the unified stack. Allows for tight management, inspection, and eventing of setting and value management. commit 901fe103da0fce4b40f33b0a8b64404049ae03cf Author: Amber <[email protected]> Date: Wed Sep 27 02:38:33 2023 -0500 Set up ground work for value / settings refactor

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨c377e4d

⁨giterated-stack/src/lib.rs⁩ - ⁨21265⁩ bytes
Raw
1 mod handler;
2 mod meta;
3 pub mod provider;
4 pub use handler::{GiteratedStack, GiteratedStackState, *};
5 pub use meta::*;
6 use serde::{de::DeserializeOwned, Deserialize, Serialize};
7 pub mod state;
8 pub mod update;
9
10 use std::{any::Any, convert::Infallible, future::Future, ops::Deref, pin::Pin, sync::Arc};
11
12 use core::fmt::Debug;
13 use futures_util::FutureExt;
14 use giterated_models::{
15 error::{ExtractorError, IntoInternalError, OperationError, UnauthorizedError},
16 instance::{
17 AuthenticationTokenRequest, Instance, RegisterAccountRequest, RepositoryCreateRequest,
18 },
19 object::GiteratedObject,
20 object_backend::ObjectBackend,
21 operation::GiteratedOperation,
22 repository::{AccessList, Repository},
23 settings::{GetSetting, SetSetting, Setting},
24 user::User,
25 value::{GetValue, GiteratedObjectValue},
26 };
27
28 #[derive(Clone, Debug, Hash, Eq, PartialEq)]
29 struct ObjectOperationPair {
30 pub object_name: String,
31 pub operation_name: String,
32 }
33
34 impl ObjectOperationPair {
35 #[allow(unused)]
36 pub fn from_types<O: GiteratedObject, D: GiteratedOperation<O>>() -> Self {
37 Self {
38 object_name: O::object_name().to_string(),
39 operation_name: D::operation_name().to_string(),
40 }
41 }
42 }
43
44 #[derive(Clone, Debug, Hash, Eq, PartialEq)]
45 pub struct ObjectValuePair {
46 pub object_kind: String,
47 pub value_kind: String,
48 }
49
50 impl ObjectValuePair {
51 pub fn from_types<O: GiteratedObject, D: GiteratedObjectValue<Object = O>>() -> Self {
52 Self {
53 object_kind: O::object_name().to_string(),
54 value_kind: D::value_name().to_string(),
55 }
56 }
57 }
58
59 #[derive(Clone, Debug, Hash, Eq, PartialEq)]
60 pub struct ObjectSettingPair {
61 pub object_kind: String,
62 pub setting_name: String,
63 }
64
65 impl ObjectSettingPair {
66 pub fn from_types<O: GiteratedObject, S: Setting>() -> Self {
67 Self {
68 object_kind: O::object_name().to_string(),
69 setting_name: S::name().to_string(),
70 }
71 }
72 }
73
74 #[async_trait::async_trait(?Send)]
75 pub trait GiteratedOperationHandler<
76 L,
77 O: GiteratedObject,
78 D: GiteratedOperation<O>,
79 S: Send + Sync + Clone,
80 >
81 {
82 fn operation_name(&self) -> &str;
83 fn object_name(&self) -> &str;
84
85 async fn handle(
86 &self,
87 object: &O,
88 operation: D,
89 state: S,
90 operation_state: &StackOperationState,
91 ) -> Result<D::Success, OperationError<D::Failure>>;
92 }
93
94 #[async_trait::async_trait(?Send)]
95 impl<O, D, F, S> GiteratedOperationHandler<(), O, D, S> for F
96 where
97 F: FnMut(
98 &O,
99 D,
100 S,
101 )
102 -> Pin<Box<dyn Future<Output = Result<D::Success, OperationError<D::Failure>>>>>
103 + Send
104 + Sync
105 + Clone,
106 O: GiteratedObject + Send + Sync,
107 D: GiteratedOperation<O> + 'static,
108 <D as GiteratedOperation<O>>::Failure: Send,
109 S: Send + Sync + Clone + 'static,
110 {
111 fn operation_name(&self) -> &str {
112 D::operation_name()
113 }
114
115 fn object_name(&self) -> &str {
116 O::object_name()
117 }
118
119 async fn handle(
120 &self,
121 object: &O,
122 operation: D,
123 state: S,
124 _operation_state: &StackOperationState,
125 ) -> Result<D::Success, OperationError<D::Failure>> {
126 self.clone()(object, operation, state).await
127 }
128 }
129
130 #[async_trait::async_trait(?Send)]
131 impl<O, O1, D, F, S> GiteratedOperationHandler<(O1,), O, D, S> for F
132 where
133 F: FnMut(
134 &O,
135 D,
136 S,
137 O1,
138 )
139 -> Pin<Box<dyn Future<Output = Result<D::Success, OperationError<D::Failure>>>>>
140 + Send
141 + Sync
142 + Clone,
143 O: GiteratedObject + Send + Sync,
144 D: GiteratedOperation<O> + 'static + Send + Sync,
145 <D as GiteratedOperation<O>>::Failure: Send,
146 S: Send + Sync + Clone + 'static,
147 O1: FromOperationState<O, D>,
148 ExtractorError<<O1 as FromOperationState<O, D>>::Error>: Into<anyhow::Error>,
149 {
150 fn operation_name(&self) -> &str {
151 D::operation_name()
152 }
153
154 fn object_name(&self) -> &str {
155 O::object_name()
156 }
157
158 async fn handle(
159 &self,
160 object: &O,
161 operation: D,
162 state: S,
163 operation_state: &StackOperationState,
164 ) -> Result<D::Success, OperationError<D::Failure>> {
165 let o1 = O1::from_state(object, &operation, operation_state)
166 .await
167 .as_internal_error()?;
168 self.clone()(object, operation, state, o1).await
169 }
170 }
171
172 #[async_trait::async_trait(?Send)]
173 impl<O, O1, O2, D, F, S> GiteratedOperationHandler<(O1, O2), O, D, S> for F
174 where
175 F: FnMut(
176 &O,
177 D,
178 S,
179 O1,
180 O2,
181 )
182 -> Pin<Box<dyn Future<Output = Result<D::Success, OperationError<D::Failure>>>>>
183 + Send
184 + Sync
185 + Clone,
186 O: GiteratedObject + Send + Sync,
187 D: GiteratedOperation<O> + 'static + Send + Sync,
188 <D as GiteratedOperation<O>>::Failure: Send,
189 S: Send + Sync + Clone + 'static,
190 O1: FromOperationState<O, D>,
191 ExtractorError<<O1 as FromOperationState<O, D>>::Error>: Into<anyhow::Error>,
192 O2: FromOperationState<O, D>,
193 ExtractorError<<O2 as FromOperationState<O, D>>::Error>: Into<anyhow::Error>,
194 {
195 fn operation_name(&self) -> &str {
196 D::operation_name()
197 }
198
199 fn object_name(&self) -> &str {
200 O::object_name()
201 }
202
203 async fn handle(
204 &self,
205 object: &O,
206 operation: D,
207 state: S,
208 operation_state: &StackOperationState,
209 ) -> Result<D::Success, OperationError<D::Failure>> {
210 let o1 = O1::from_state(object, &operation, operation_state)
211 .await
212 .as_internal_error()?;
213 let o2 = O2::from_state(object, &operation, operation_state)
214 .await
215 .as_internal_error()?;
216 self.clone()(object, operation, state, o1, o2).await
217 }
218 }
219
220 #[async_trait::async_trait(?Send)]
221 impl<O, O1, O2, O3, D, F, S> GiteratedOperationHandler<(O1, O2, O3), O, D, S> for F
222 where
223 F: FnMut(
224 &O,
225 D,
226 S,
227 O1,
228 O2,
229 O3,
230 )
231 -> Pin<Box<dyn Future<Output = Result<D::Success, OperationError<D::Failure>>>>>
232 + Send
233 + Sync
234 + Clone,
235 O: GiteratedObject + Send + Sync,
236 D: GiteratedOperation<O> + 'static + Send + Sync,
237 <D as GiteratedOperation<O>>::Failure: Send,
238 S: Send + Sync + Clone + 'static,
239 O1: FromOperationState<O, D>,
240 ExtractorError<<O1 as FromOperationState<O, D>>::Error>: Into<anyhow::Error>,
241 O2: FromOperationState<O, D>,
242 ExtractorError<<O2 as FromOperationState<O, D>>::Error>: Into<anyhow::Error>,
243 O3: FromOperationState<O, D>,
244 ExtractorError<<O3 as FromOperationState<O, D>>::Error>: Into<anyhow::Error>,
245 {
246 fn operation_name(&self) -> &str {
247 D::operation_name()
248 }
249
250 fn object_name(&self) -> &str {
251 O::object_name()
252 }
253
254 async fn handle(
255 &self,
256 object: &O,
257 operation: D,
258 state: S,
259 operation_state: &StackOperationState,
260 ) -> Result<D::Success, OperationError<D::Failure>> {
261 let o1 = O1::from_state(object, &operation, operation_state)
262 .await
263 .as_internal_error()?;
264 let o2 = O2::from_state(object, &operation, operation_state)
265 .await
266 .as_internal_error()?;
267 let o3 = O3::from_state(object, &operation, operation_state)
268 .await
269 .as_internal_error()?;
270 self.clone()(object, operation, state, o1, o2, o3).await
271 }
272 }
273
274 pub struct OperationWrapper {
275 func: Box<
276 dyn Fn(
277 &(dyn Any + Send + Sync),
278 &(dyn Any + Send + Sync),
279 &(dyn Any + Send + Sync),
280 StackOperationState,
281 ) -> Pin<
282 Box<
283 dyn Future<
284 Output = Result<
285 Box<dyn Any + Send + Sync>,
286 OperationError<Box<dyn Any + Send + Sync>>,
287 >,
288 >,
289 >,
290 > + Send
291 + Sync,
292 >,
293 state: Box<dyn Any + Send + Sync>,
294 }
295
296 impl OperationWrapper {
297 pub fn new<
298 A,
299 O: GiteratedObject + Send + Sync + 'static,
300 D: GiteratedOperation<O> + 'static + Clone,
301 F: GiteratedOperationHandler<A, O, D, S> + 'static + Send + Sync + Clone,
302 S: GiteratedStackState + 'static,
303 >(
304 handler: F,
305 state: S,
306 ) -> Self
307 where
308 D::Failure: Send + Sync,
309 D::Success: Send + Sync,
310 {
311 Self {
312 func: Box::new(move |object, operation, state, operation_state| {
313 let handler = handler.clone();
314 let state = state.downcast_ref::<S>().unwrap().clone();
315 let object: &O = object.downcast_ref().unwrap();
316 let operation: &D = operation.downcast_ref().unwrap();
317 let object = object.clone();
318 let operation = operation.clone();
319 async move {
320 let result = handler
321 .handle(&object, operation, state, &operation_state)
322 .await;
323 result
324 .map(|success| Box::new(success) as _)
325 .map_err(|err| match err {
326 OperationError::Operation(err) => {
327 OperationError::Operation(Box::new(err) as _)
328 }
329 OperationError::Internal(internal) => {
330 OperationError::Internal(internal)
331 }
332 OperationError::Unhandled => OperationError::Unhandled,
333 })
334 }
335 .boxed_local()
336 }),
337 state: Box::new(state),
338 }
339 }
340
341 async fn handle(
342 &self,
343 object: &Box<dyn Any + Send + Sync>,
344 operation: &Box<dyn Any + Send + Sync>,
345 operation_state: &StackOperationState,
346 ) -> Result<Box<dyn Any + Send + Sync>, OperationError<Box<dyn Any + Send + Sync>>> {
347 (self.func)(
348 (*object).as_ref(),
349 (*operation).as_ref(),
350 self.state.as_ref(),
351 operation_state.clone(),
352 )
353 .await
354 }
355 }
356
357 #[async_trait::async_trait(?Send)]
358 pub trait FromOperationState<O: GiteratedObject, D: GiteratedOperation<O>>: Sized + Clone {
359 type Error: Into<anyhow::Error>;
360
361 async fn from_state(
362 object: &O,
363 operation: &D,
364 state: &StackOperationState,
365 ) -> Result<Self, ExtractorError<Self::Error>>;
366 }
367
368 #[async_trait::async_trait(?Send)]
369 impl<O: GiteratedObject, D: GiteratedOperation<O>> FromOperationState<O, D>
370 for Arc<GiteratedStack>
371 {
372 type Error = Infallible;
373
374 async fn from_state(
375 _object: &O,
376 _operation: &D,
377 state: &StackOperationState,
378 ) -> Result<Self, ExtractorError<Infallible>> {
379 Ok(state.runtime.clone())
380 }
381 }
382
383 #[async_trait::async_trait(?Send)]
384 impl<O: GiteratedObject, D: GiteratedOperation<O>> FromOperationState<O, D>
385 for StackOperationState
386 {
387 type Error = Infallible;
388
389 async fn from_state(
390 _object: &O,
391 _operation: &D,
392 state: &StackOperationState,
393 ) -> Result<StackOperationState, ExtractorError<Infallible>> {
394 Ok(state.clone())
395 }
396 }
397
398 #[derive(Debug, thiserror::Error, Serialize, Deserialize)]
399 #[error("missing value")]
400 pub struct MissingValue;
401
402 #[async_trait::async_trait(?Send)]
403 impl<O: GiteratedObject, D: GiteratedOperation<O> + Send + Sync> FromOperationState<O, D>
404 for AuthenticatedUser
405 {
406 type Error = MissingValue;
407
408 async fn from_state(
409 _object: &O,
410 _operation: &D,
411 state: &StackOperationState,
412 ) -> Result<AuthenticatedUser, ExtractorError<MissingValue>> {
413 state.user.clone().ok_or(ExtractorError(MissingValue))
414 }
415 }
416
417 #[async_trait::async_trait(?Send)]
418 impl<O: GiteratedObject, D: GiteratedOperation<O> + Send + Sync> FromOperationState<O, D>
419 for AuthenticatedInstance
420 {
421 type Error = MissingValue;
422
423 async fn from_state(
424 _object: &O,
425 _operation: &D,
426 state: &StackOperationState,
427 ) -> Result<AuthenticatedInstance, ExtractorError<MissingValue>> {
428 state.instance.clone().ok_or(ExtractorError(MissingValue))
429 }
430 }
431
432 #[async_trait::async_trait(?Send)]
433 impl<
434 T: FromOperationState<O, D> + Send + Sync,
435 O: GiteratedObject + Sync,
436 D: GiteratedOperation<O> + Send + Sync,
437 > FromOperationState<O, D> for Option<T>
438 {
439 type Error = Infallible;
440
441 async fn from_state(
442 object: &O,
443 operation: &D,
444 state: &StackOperationState,
445 ) -> Result<Option<T>, ExtractorError<Infallible>> {
446 Ok(T::from_state(object, operation, state).await.ok())
447 }
448 }
449
450 #[derive(Clone)]
451 pub struct AuthorizedUser(AuthenticatedUser);
452
453 #[derive(Clone)]
454 pub struct AuthorizedInstance(AuthenticatedInstance);
455
456 #[async_trait::async_trait(?Send)]
457 pub trait AuthorizedOperation<O: GiteratedObject>: GiteratedOperation<O> {
458 type Error: Into<anyhow::Error>;
459
460 async fn authorize(
461 &self,
462 authorize_for: &O,
463 state: &StackOperationState,
464 ) -> Result<bool, ExtractorError<Self::Error>>;
465 }
466
467 #[async_trait::async_trait(?Send)]
468 impl<O: GiteratedObject + Send + Sync + Debug + 'static> AuthorizedOperation<O> for GetValue {
469 type Error = anyhow::Error;
470
471 async fn authorize(
472 &self,
473 authorize_for: &O,
474 operation_state: &StackOperationState,
475 ) -> Result<bool, ExtractorError<anyhow::Error>> {
476 Ok(operation_state
477 .runtime
478 .get_object::<O>(&authorize_for.to_string(), operation_state)
479 .await
480 .is_ok())
481 }
482 }
483
484 #[async_trait::async_trait(?Send)]
485 impl AuthorizedOperation<User> for SetSetting {
486 type Error = MissingValue;
487
488 async fn authorize(
489 &self,
490 authorize_for: &User,
491 operation_state: &StackOperationState,
492 ) -> Result<bool, ExtractorError<MissingValue>> {
493 let authenticated_user = operation_state.user.as_ref().ok_or(MissingValue)?;
494
495 Ok(authorize_for == authenticated_user.deref())
496 }
497 }
498
499 #[async_trait::async_trait(?Send)]
500 impl AuthorizedOperation<User> for GetSetting {
501 type Error = MissingValue;
502
503 async fn authorize(
504 &self,
505 authorize_for: &User,
506 operation_state: &StackOperationState,
507 ) -> Result<bool, ExtractorError<MissingValue>> {
508 let authenticated_user = operation_state.user.as_ref().ok_or(MissingValue)?;
509
510 Ok(authorize_for == authenticated_user.deref())
511 }
512 }
513
514 #[async_trait::async_trait(?Send)]
515 impl AuthorizedOperation<Repository> for SetSetting {
516 type Error = anyhow::Error;
517
518 async fn authorize(
519 &self,
520 authorize_for: &Repository,
521 operation_state: &StackOperationState,
522 ) -> Result<bool, ExtractorError<anyhow::Error>> {
523 let authenticated_user = operation_state
524 .user
525 .as_ref()
526 .ok_or_else(|| anyhow::Error::from(MissingValue))?;
527
528 let mut object = operation_state
529 .runtime
530 .get_object::<Repository>(&authorize_for.to_string(), operation_state)
531 .await
532 .map_err(anyhow::Error::from)?;
533
534 let access_list = object
535 .get_setting::<AccessList>(operation_state)
536 .await
537 .map_err(anyhow::Error::from)?;
538
539 if access_list
540 .0
541 .iter()
542 .any(|user| user == authenticated_user.deref())
543 {
544 Ok(true)
545 } else {
546 Ok(false)
547 }
548 }
549 }
550
551 #[async_trait::async_trait(?Send)]
552 impl AuthorizedOperation<Repository> for GetSetting {
553 type Error = anyhow::Error;
554
555 async fn authorize(
556 &self,
557 authorize_for: &Repository,
558 operation_state: &StackOperationState,
559 ) -> Result<bool, ExtractorError<anyhow::Error>> {
560 let authenticated_user = operation_state
561 .user
562 .as_ref()
563 .ok_or_else(|| anyhow::Error::from(MissingValue))?;
564
565 let mut object = operation_state
566 .runtime
567 .get_object::<Repository>(&authorize_for.to_string(), operation_state)
568 .await
569 .map_err(anyhow::Error::from)?;
570
571 let access_list = object
572 .get_setting::<AccessList>(operation_state)
573 .await
574 .map_err(anyhow::Error::from)?;
575
576 if access_list
577 .0
578 .iter()
579 .any(|user| user == authenticated_user.deref())
580 {
581 Ok(true)
582 } else {
583 Ok(false)
584 }
585 }
586 }
587
588 #[async_trait::async_trait(?Send)]
589 impl AuthorizedOperation<Instance> for RegisterAccountRequest {
590 type Error = Infallible;
591
592 async fn authorize(
593 &self,
594 authorize_for: &Instance,
595 state: &StackOperationState,
596 ) -> Result<bool, ExtractorError<Infallible>> {
597 if state.our_instance == *authorize_for {
598 Ok(true)
599 } else {
600 Ok(false)
601 }
602 }
603 }
604
605 #[async_trait::async_trait(?Send)]
606 impl AuthorizedOperation<Instance> for AuthenticationTokenRequest {
607 type Error = Infallible;
608
609 async fn authorize(
610 &self,
611 authorize_for: &Instance,
612 state: &StackOperationState,
613 ) -> Result<bool, ExtractorError<Infallible>> {
614 if state.our_instance == *authorize_for {
615 Ok(true)
616 } else {
617 Ok(false)
618 }
619 }
620 }
621
622 #[async_trait::async_trait(?Send)]
623 impl AuthorizedOperation<Instance> for RepositoryCreateRequest {
624 type Error = Infallible;
625
626 async fn authorize(
627 &self,
628 authorize_for: &Instance,
629 state: &StackOperationState,
630 ) -> Result<bool, ExtractorError<Infallible>> {
631 if state.our_instance == *authorize_for {
632 Ok(true)
633 } else {
634 Ok(false)
635 }
636 }
637 }
638
639 #[async_trait::async_trait(?Send)]
640 impl<A: AuthorizedOperation<User> + Send + Sync> FromOperationState<User, A> for AuthorizedUser {
641 type Error = UnauthorizedError;
642
643 async fn from_state(
644 object: &User,
645 operation: &A,
646 state: &StackOperationState,
647 ) -> Result<AuthorizedUser, ExtractorError<UnauthorizedError>> {
648 // TODO
649 let authenticated = AuthenticatedUser::from_state(object, operation, state)
650 .await
651 .map_err(|_| ExtractorError(UnauthorizedError))?;
652
653 match operation.authorize(object, state).await {
654 Ok(authorized) => {
655 assert!(authorized);
656 }
657 Err(_err) => return Err(ExtractorError(UnauthorizedError)),
658 };
659
660 Ok(AuthorizedUser(authenticated))
661 }
662 }
663
664 #[async_trait::async_trait(?Send)]
665 impl<A: AuthorizedOperation<Instance> + Send + Sync> FromOperationState<Instance, A>
666 for AuthorizedInstance
667 {
668 type Error = UnauthorizedError;
669
670 async fn from_state(
671 object: &Instance,
672 operation: &A,
673 state: &StackOperationState,
674 ) -> Result<AuthorizedInstance, ExtractorError<UnauthorizedError>> {
675 //TODO
676 let authenticated = AuthenticatedInstance::from_state(object, operation, state)
677 .await
678 .map_err(|_| ExtractorError(UnauthorizedError))?;
679
680 match operation.authorize(object, state).await {
681 Ok(authorized) => {
682 assert!(authorized);
683 }
684 Err(_err) => return Err(ExtractorError(UnauthorizedError)),
685 };
686
687 Ok(AuthorizedInstance(authenticated))
688 }
689 }
690
691 // #[async_trait::async_trait> FromOperationState for Option<T> {
692 // type Error = ();
693
694 // async fn from_state(state: &StackOperationState) -> Result<Option<T>, OperationError<()>> {
695 // Ok(T::from_state(]
696 // impl<T: FromOperationStatestate).await.ok())
697 // }
698 // }
699
700 #[derive(Clone)]
701 pub struct StackOperationState {
702 pub our_instance: Instance,
703 pub runtime: Arc<GiteratedStack>,
704 pub instance: Option<AuthenticatedInstance>,
705 pub user: Option<AuthenticatedUser>,
706 }
707
708 #[derive(Clone, Debug)]
709 pub struct AuthenticatedInstance(Instance);
710
711 impl AuthenticatedInstance {
712 pub fn new(instance: Instance) -> Self {
713 AuthenticatedInstance(instance)
714 }
715 }
716
717 impl Deref for AuthenticatedInstance {
718 type Target = Instance;
719
720 fn deref(&self) -> &Self::Target {
721 &self.0
722 }
723 }
724
725 #[derive(Clone, Debug)]
726 pub struct AuthenticatedUser(User);
727
728 impl AuthenticatedUser {
729 pub fn new(user: User) -> Self {
730 AuthenticatedUser(user)
731 }
732 }
733
734 impl Deref for AuthenticatedUser {
735 type Target = User;
736
737 fn deref(&self) -> &Self::Target {
738 &self.0
739 }
740 }
741
742 #[derive(Clone, Debug, Serialize, Deserialize)]
743 #[serde(transparent)]
744 #[serde(bound(deserialize = "S: DeserializeOwned"))]
745 pub struct SettingUpdate<S: Setting + Serialize + DeserializeOwned>(pub S);
746
747 impl<O, S> GiteratedOperation<O> for SettingUpdate<S>
748 where
749 O: GiteratedObject,
750 S: Setting + Serialize + DeserializeOwned,
751 {
752 type Success = ();
753
754 type Failure = ();
755 }
756