diff options
Diffstat (limited to 'engine/src/windowing/dpi.rs')
| -rw-r--r-- | engine/src/windowing/dpi.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/engine/src/windowing/dpi.rs b/engine/src/windowing/dpi.rs index e3b1be1..9bc42e1 100644 --- a/engine/src/windowing/dpi.rs +++ b/engine/src/windowing/dpi.rs @@ -75,6 +75,12 @@ impl<Pixel> PhysicalPosition<Pixel> } } + /// Attempts to convert the `x` and `y` values in `source` from the type `SourcePixel` + /// to the type `Pixel`. + /// + /// # Errors + /// Returns `Err` if conversion of either `x` or `y` by their respective `TryFrom` + /// implementations fails. pub fn try_convert_from<SourcePixel>( source: PhysicalPosition<SourcePixel>, ) -> Result<Self, Pixel::Error> @@ -100,6 +106,12 @@ pub struct LogicalPosition<Pixel> impl<Pixel> LogicalPosition<Pixel> { + /// Attempts to convert the `x` and `y` values in `source` from the type `SourcePixel` + /// to the type `Pixel`. + /// + /// # Errors + /// Returns `Err` if conversion of either `x` or `y` by their respective `TryFrom` + /// implementations fails. pub fn try_convert_from<SourcePixel>( source: LogicalPosition<SourcePixel>, ) -> Result<Self, Pixel::Error> @@ -159,6 +171,12 @@ impl<Pixel> PhysicalSize<Pixel> impl<Pixel> PhysicalSize<Pixel> { + /// Attempts to convert the `width` and `height` values in `source` from the type + /// `SourcePixel` to the type `Pixel`. + /// + /// # Errors + /// Returns `Err` if conversion of either `width` or `height` by their respective + /// `TryFrom` implementations fails. pub fn try_convert_from<SourcePixel>( source: PhysicalSize<SourcePixel>, ) -> Result<Self, Pixel::Error> @@ -184,6 +202,12 @@ pub struct LogicalSize<Pixel> impl<Pixel> LogicalSize<Pixel> { + /// Attempts to convert the `width` and `height` values in `source` from the type + /// `SourcePixel` to the type `Pixel`. + /// + /// # Errors + /// Returns `Err` if conversion of either `width` or `height` by their respective + /// `TryFrom` implementations fails. pub fn try_convert_from<SourcePixel>( source: LogicalSize<SourcePixel>, ) -> Result<Self, Pixel::Error> |
