@@ -5,6 +5,7 @@ use anyhow::Result;
55use async_trait:: async_trait;
66use warp_server_client:: cloud_object:: CloudObjectUpsertParams ;
77// Re-exported from warp_server_client.
8+ pub use warp_server_client:: cloud_object:: { GenericStringModel , Serializer } ;
89pub use warp_server_client:: ids:: GenericStringObjectId ;
910
1011use crate :: appearance:: Appearance ;
@@ -119,27 +120,6 @@ pub trait StringModel: Clone + Debug + PartialEq + Send + Sync + 'static {
119120 fn uniqueness_key ( & self ) -> Option < GenericStringObjectUniqueKey > ;
120121}
121122
122- /// A serializer goes from a model to a string and back.
123- pub trait Serializer < M > : Debug + Clone + ' static {
124- fn serialize ( model : & M ) -> SerializedModel ;
125- fn deserialize_owned ( serialized : & str ) -> Result < M >
126- where
127- Self : Sized ;
128- }
129-
130- /// A `GenericStringModel` is a generic implementation of model types that can serialize to/from string.
131- /// given a particular serializer.
132- #[ derive( Clone , Debug , PartialEq , Default ) ]
133- pub struct GenericStringModel < M , S >
134- where
135- M : StringModel <
136- CloudObjectType = GenericCloudObject < GenericStringObjectId , GenericStringModel < M , S > > ,
137- > ,
138- S : Serializer < M > ,
139- {
140- pub string_model : M ,
141- }
142-
143123impl < M , S > CloudStringObject for GenericCloudObject < GenericStringObjectId , GenericStringModel < M , S > >
144124where
145125 M : StringModel <
@@ -346,25 +326,3 @@ where
346326 self . string_model . to_warp_drive_item ( id, appearance, object)
347327 }
348328}
349-
350- impl < M , S > GenericStringModel < M , S >
351- where
352- M : StringModel <
353- CloudObjectType = GenericCloudObject < GenericStringObjectId , GenericStringModel < M , S > > ,
354- > ,
355- S : Serializer < M > ,
356- {
357- pub fn deserialize_owned ( serialized : & str ) -> Result < Self > {
358- S :: deserialize_owned ( serialized) . map ( Self :: new)
359- }
360-
361- pub fn new ( model : M ) -> Self {
362- Self {
363- string_model : model,
364- }
365- }
366-
367- pub fn json_model ( & self ) -> & M {
368- & self . string_model
369- }
370- }
0 commit comments