Add implementation note

This commit is contained in:
Hanno Braun 2022-04-11 16:18:15 +02:00
parent a5ea5877e8
commit add9c4f0ef

View File

@ -12,6 +12,21 @@ pub struct Polygon {
} }
impl Polygon { impl Polygon {
/// Construct an instance of `Polygon`
///
/// # Implementation note
///
/// This method takes a `Surface`, but `Polygon` only uses that for
/// generating debug info. It might be better, if `Polygon` had a field
/// where it stored debug info specific to its algorithm. Then code using
/// `Polygon` could access that `Polygon`-specific debug info and translate
/// that into `DebugInfo`, as necessary.
///
/// This would have the advantage of removing this dependency on `Surface`.
/// It would also make the test code a bit cleaner, as it wouldn't have to
/// bother with the `DebugInfo` anymore. Also, the `Polygon`-specific debug
/// info could potentially be more useful in test code, as a debugging tool
/// there.
pub fn new(surface: Surface) -> Self { pub fn new(surface: Surface) -> Self {
Self { Self {
surface, surface,