pub struct SketchDoc {
pub points: Vec<SketchPoint>,
pub geometries: Vec<SketchGeometry>,
pub constraints: Vec<SketchConstraint>,
}Expand description
The editable sketch document — a typed mirror of the solver’s
{points, geometries, constraints}. Unknown top-level keys (e.g. the solved
output’s diagnostics) are ignored on load; crate::sketch::solve pulls
diagnostics out into SketchDiagnostics separately.
Fields§
§points: Vec<SketchPoint>§geometries: Vec<SketchGeometry>§constraints: Vec<SketchConstraint>Implementations§
Source§impl SketchDoc
impl SketchDoc
Sourcepub fn point(&self, id: &Value) -> Option<&SketchPoint>
pub fn point(&self, id: &Value) -> Option<&SketchPoint>
Look up a point by id (matched via id_key, mirroring the solver’s
point_key identity).
Sourcepub fn point_mut(&mut self, id: &Value) -> Option<&mut SketchPoint>
pub fn point_mut(&mut self, id: &Value) -> Option<&mut SketchPoint>
Mutable lookup of a point by id (used by the interactive point drag to write
a solved coordinate / toggle the transient fixed anchor flag).
Sourcepub fn constrained_point_keys(&self) -> HashSet<String>
pub fn constrained_point_keys(&self) -> HashSet<String>
The set of non-temporary constrained point ids (as id_key strings) —
the fallback used to color under-constrained points when the solver did not
supply per-point mobility (it always does, so this is a safety net).
Source§impl SketchDoc
impl SketchDoc
Sourcepub fn next_point_id(&self) -> Value
pub fn next_point_id(&self) -> Value
Mint the next unused POINT id (max numeric id + 1, else a count-based id),
non-colliding within self.points.
Sourcepub fn next_geometry_id(&self) -> Value
pub fn next_geometry_id(&self) -> Value
Mint the next unused GEOMETRY id (max numeric id + 1, else a count-based
id), non-colliding within self.geometries.
Source§impl SketchDoc
impl SketchDoc
Sourcepub fn next_constraint_id(&self) -> Value
pub fn next_constraint_id(&self) -> Value
Mint the next unused CONSTRAINT id (max numeric id + 1, else a count-based
id), non-colliding within self.constraints. Constraints carry their id in
the raw map’s "id" field.
Sourcepub fn geometry(&self, id: &Value) -> Option<&SketchGeometry>
pub fn geometry(&self, id: &Value) -> Option<&SketchGeometry>
Look up a geometry by id (matched via id_key, mirroring Self::point).
Sourcepub fn geometry_mut(&mut self, id: &Value) -> Option<&mut SketchGeometry>
pub fn geometry_mut(&mut self, id: &Value) -> Option<&mut SketchGeometry>
Mutable lookup of a geometry by id (used by the construction toggle to flip a
selected geometry’s construction flag in its extra bag).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SketchDoc
impl<'de> Deserialize<'de> for SketchDoc
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for SketchDoc
Auto Trait Implementations§
impl Forget for SketchDoc
impl Freeze for SketchDocwhere
*const u8 is !null: Freeze,
PhantomData<SketchPoint>: Freeze,
PhantomData<SketchGeometry>: Freeze,
PhantomData<SketchConstraint>: Freeze,
impl Move for SketchDoc
impl RefUnwindSafe for SketchDoc
impl Send for SketchDoc
impl Sync for SketchDoc
impl Unpin for SketchDoc
impl UnsafeUnpin for SketchDocwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<SketchPoint>: UnsafeUnpin,
PhantomData<SketchGeometry>: UnsafeUnpin,
PhantomData<SketchConstraint>: UnsafeUnpin,
impl UnwindSafe for SketchDoc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.