@@ -1245,118 +1245,8 @@ where
1245
1245
///
1246
1246
/// # Deriving
1247
1247
///
1248
- /// You can easily derive this trait for your own types. To derive this trait,
1249
- /// you have to attach `#[derive(MemSink)]` to your struct definition (note:
1250
- /// currently, the trait can only be derived for structs with named fields).
1251
- /// You also have to annotate your fields with `#[lox(...)]` attributes to tell
1252
- /// the derive macro what a field should be used for. Example:
1253
- ///
1254
- /// ```
1255
- /// use lox::{
1256
- /// MemSink, VertexHandle,
1257
- /// cgmath::Point3,
1258
- /// ds::HalfEdgeMesh,
1259
- /// map::DenseMap,
1260
- /// };
1261
- ///
1262
- ///
1263
- /// #[derive(MemSink)]
1264
- /// struct MyMesh {
1265
- /// #[lox(core_mesh)]
1266
- /// mesh: HalfEdgeMesh,
1267
- ///
1268
- /// #[lox(vertex_position)]
1269
- /// positions: DenseMap<VertexHandle, Point3<f32>>,
1270
- /// }
1271
- /// ```
1272
- ///
1273
- /// There is one required field: the core mesh field. That field's type has to
1274
- /// implement several mesh traits, in particular `MeshMut` and `TriMeshMut`.
1275
- /// You have to annotate that mesh with `#[lox(core_mesh)]`.
1276
- ///
1277
- /// Additionally, you can have fields for each mesh property, like vertex
1278
- /// position or face colors. The type of those fields has to implement
1279
- /// `PropStoreMut` with a compatible element type. You have to annotate these
1280
- /// property fields with the corresponding attribute. The available properties
1281
- /// are:
1282
- ///
1283
- /// - `vertex_position`
1284
- /// - `vertex_normal`
1285
- /// - `vertex_color`
1286
- /// - `face_normal`
1287
- /// - `face_color`
1288
- ///
1289
- /// Furthermore, there are some configurations (like the cast mode) that can be
1290
- /// configured via `lox(...)` attributes as well. See below for more
1291
- /// information.
1292
- ///
1293
- ///
1294
- /// ### Cast modes
1295
- ///
1296
- /// You can set a *cast mode* for each field. A `MemSink` has to be able to
1297
- /// "handle" any primitive type as the source is allowed to call the property
1298
- /// methods with any type. The sink can handle types either by casting or by
1299
- /// returning an error. The field's cast mode determines which casts are
1300
- /// allowed and which are not. Possible cast modes:
1301
- ///
1302
- /// - `cast = "none"`
1303
- /// - `cast = "lossless"`
1304
- /// - `cast = "rounding"`
1305
- /// - `cast = "clamping"`
1306
- /// - `cast = "lossy"` (*default*)
1307
- ///
1308
- /// The `none` mode does not allow casting at all. If the type provided by the
1309
- /// source does not match the type in your struct, an error is returned. All
1310
- /// other modes correspond to the cast modes in the [`cast`
1311
- /// module][crate::cast].
1312
- ///
1313
- /// Note that the cast modes are used by `derive(MemSource)` as well.
1314
- ///
1315
- /// You can specify the cast mode either per field or globally on the whole
1316
- /// struct. The mode of the struct applies to all fields that don't have a
1317
- /// field-specific mode.
1318
- ///
1319
- /// ```
1320
- /// # use lox::{
1321
- /// # MemSink, VertexHandle,
1322
- /// # cgmath::{Point3, Vector3},
1323
- /// # ds::HalfEdgeMesh,
1324
- /// # map::DenseMap,
1325
- /// # };
1326
- /// #
1327
- /// #[derive(MemSink)]
1328
- /// #[lox(cast = "none")]
1329
- /// struct MyMesh {
1330
- /// #[lox(core_mesh)]
1331
- /// mesh: HalfEdgeMesh,
1332
- ///
1333
- /// #[lox(vertex_position)]
1334
- /// positions: DenseMap<VertexHandle, Point3<f32>>,
1335
- ///
1336
- /// #[lox(vertex_normal, cast = "lossy")]
1337
- /// normals: DenseMap<VertexHandle, Vector3<f32>>,
1338
- /// }
1339
- /// ```
1340
- ///
1341
- /// In this example, the vertex positions inherit the "struct global" cast mode
1342
- /// (`none`), while the vertex normals override that mode to `lossy`.
1343
- ///
1344
- ///
1345
- /// ### Exact traits required for each field
1346
- ///
1347
- /// Traits required for the `core_mesh` field:
1348
- /// - TODO
1349
- ///
1350
- /// Traits required for property fields. For type `T` of the field:
1351
- /// - `T` must implement [`PropStoreMut`][crate::map::PropStoreMut] (with
1352
- /// fitting handle type). Additionally:
1353
- /// - For `vertex_position`: `T::Target` must implement
1354
- /// [`Pos3Like`][crate::prop::Pos3Like].
1355
- /// - For `*_normal`: `T::Target` must implement
1356
- /// [`Vec3Like`][crate::prop::Vec3Like].
1357
- /// - For `*_color`: `T::Target` must implement
1358
- /// [`ColorLike`][crate::prop::ColorLike] and `T::Target::Channel` must
1359
- /// implement [`Primitive`].
1248
+ /// You can easily derive this trait for your own types. See [the derive
1249
+ /// macro's documentation](../derive.MemSink.html) for more information.
1360
1250
pub trait MemSink {
1361
1251
// =======================================================================
1362
1252
// ===== Mesh connectivity
@@ -1606,52 +1496,8 @@ where
1606
1496
///
1607
1497
/// # Deriving
1608
1498
///
1609
- /// You can easily derive this trait for your own types. To derive this trait,
1610
- /// you have to attach `#[derive(MemSource)]` to your struct definition (note:
1611
- /// currently, the trait can only be derived for structs with named fields).
1612
- /// You also have to annotate your fields with `#[lox(...)]` attributes to tell
1613
- /// the derive macro what a field should be used for. Example:
1614
- ///
1615
- /// ```
1616
- /// use lox::{
1617
- /// MemSource, VertexHandle,
1618
- /// cgmath::Point3,
1619
- /// ds::SharedVertexMesh,
1620
- /// map::DenseMap,
1621
- /// };
1622
- ///
1623
- ///
1624
- /// #[derive(MemSource)]
1625
- /// struct MyMesh {
1626
- /// #[lox(core_mesh)]
1627
- /// mesh: SharedVertexMesh,
1628
- ///
1629
- /// #[lox(vertex_position)]
1630
- /// positions: DenseMap<VertexHandle, Point3<f32>>,
1631
- /// }
1632
- /// ```
1633
- ///
1634
- /// Deriving this trait works very similar to deriving [`MemSink`]. See its
1635
- /// documentation for more information on the custom derive.
1636
- ///
1637
- ///
1638
- /// ### Exact traits required for each field
1639
- ///
1640
- /// Traits required for the `core_mesh` field:
1641
- /// - TODO
1642
- ///
1643
- /// Traits required for property fields. For type `T` of the field:
1644
- /// - `T` must implement [`PropStore`][crate::map::PropStore] (with fitting
1645
- /// handle type). Additionally:
1646
- /// - For `vertex_position`: `T::Target` must implement
1647
- /// [`Pos3Like`][crate::prop::Pos3Like] and `T::Target::Scalar` must
1648
- /// implement [`Primitive`].
1649
- /// - For `*_normal`: `T::Target` must implement
1650
- /// [`Vec3Like`][crate::prop::Vec3Like] and `T::Target::Scalar` must
1651
- /// implement [`Primitive`].
1652
- /// - For `*_color`: `T::Target` must implement
1653
- /// [`ColorLike`][crate::prop::ColorLike] and `T::Target::Channel` must
1654
- /// implement [`Primitive`].
1499
+ /// You can easily derive this trait for your own types. See [the derive
1500
+ /// macro's documentation](../derive.MemSource.html) for more information.
1655
1501
pub trait MemSource {
1656
1502
/// The type of the core mesh.
1657
1503
type CoreMesh : TriMesh + BasicAdj ;
0 commit comments