Skip to content

Commit

Permalink
Merge pull request #1409 from hannobraun/partial
Browse files Browse the repository at this point in the history
Update doc comments in partial object API
  • Loading branch information
hannobraun authored Dec 1, 2022
2 parents ddf9161 + 4e794a7 commit 2039ac3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 27 deletions.
10 changes: 2 additions & 8 deletions crates/fj-kernel/src/algorithms/approx/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,7 @@ mod tests {
fn approx_line_on_flat_surface() {
let mut services = Services::new();

let surface =
PartialSurface::from_axes(GlobalPath::x_axis(), [0., 0., 1.])
.build(&services.objects)
.insert(&mut services.objects);
let surface = services.objects.surfaces.xz_plane();
let mut curve = PartialCurve {
surface: Some(surface),
..Default::default()
Expand Down Expand Up @@ -297,10 +294,7 @@ mod tests {
fn approx_circle_on_flat_surface() {
let mut services = Services::new();

let surface =
PartialSurface::from_axes(GlobalPath::x_axis(), [0., 0., 1.])
.build(&services.objects)
.insert(&mut services.objects);
let surface = services.objects.surfaces.xz_plane();
let mut curve = PartialCurve {
surface: Some(surface),
..Default::default()
Expand Down
24 changes: 5 additions & 19 deletions crates/fj-kernel/src/partial/traits.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
use crate::{objects::Objects, services::Service};

/// Implemented for objects that a partial object type exists for
///
/// # Implementation Note
///
/// This trait is usually implemented for object types themselves, but types
/// that are already managed in the centralized object storage ([#1021])
/// implement this trait for `Handle<T>` instead. This is necessary, due to the
/// use of this type in [`MaybePartial`], but leads to some not so nice
/// inconsistencies.
///
/// Once [#1021] is addressed and all types are managed in the centralized
/// object storage, this should be changed to all object types implement this
/// directly.
///
/// [#1021]: https://github.com/hannobraun/Fornjot/issues/1021
/// [`MaybePartial`]: super::MaybePartial
pub trait HasPartial {
/// The type representing the partial variant of this object
type Partial: Partial<Full = Self>;
Expand Down Expand Up @@ -60,10 +45,11 @@ pub trait HasPartial {
/// # Implementation Note
///
/// It would be nicer to require an [`Into`] bound instead of [`From`] (see
/// documentation of those types for more information). But I think we'd need a
/// `where` clause on the associated type to specify that, which is unstable. It
/// should become stable soon though, together with generic associated types:
/// <https://github.com/rust-lang/rust/issues/44265>
/// documentation of those types for more information). Unfortunately, this
/// doesn't seem to be possible without a `where` clause on `HasPartial`, which
/// significantly reduces the convenience of using that trait, as the `where`
/// clause needs to be repeated everywhere `HasPartial` is specialized as a
/// bound.
pub trait Partial: Default + for<'a> From<&'a Self::Full> {
/// The type representing the full variant of this object
type Full;
Expand Down

0 comments on commit 2039ac3

Please sign in to comment.