Skip to content

Commit

Permalink
misc: Normalize all line endings
Browse files Browse the repository at this point in the history
  • Loading branch information
chesedo committed Sep 17, 2024
1 parent b7483fd commit 9c3de5f
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 90 deletions.
60 changes: 30 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# Despatma
[![github]](https://github.com/chesedo/despatma) [![crates-io]](https://crates.io/crates/despatma) [![docs-rs]](https://docs.rs/despatma) [![workflow]](https://github.com/chesedo/despatma/actions?query=workflow%3ARust)

[github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
[crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust
[docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logoColor=white&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K
[workflow]: https://img.shields.io/github/actions/workflow/status/chesedo/despatma/rust.yml?color=green&label=&labelColor=555555&logo=github%20actions&logoColor=white&style=for-the-badge

Despatma is a collection of `des`ign `pat`tern `ma`cros (`despatma`) born from a [Honours project](https://github.com/chesedo/cos-700/blob/master/Report%20-%20Final.pdf).
It aims to provide the most common implementations for design patterns at run-time.

This project is still a **work in progress**.
The end goal is to be as [Loki](http://loki-lib.sourceforge.net/) is for C++ and more if possible.
The following patterns are currently implemented:
- [abstract_factory] - with the help of [interpolate_traits] macro
- [visitor]
- [dependency_container]

Next up for investigation is:
- [ ] Decorator
- [ ] Proxy
- [ ] Adapter
- [ ] Mediator
- [ ] Observer
- [ ] A smarter Visitor

[abstract_factory]: https://docs.rs/despatma/latest/despatma/attr.abstract_factory.html
[interpolate_traits]: https://docs.rs/despatma/latest/despatma/attr.interpolate_traits.html
[visitor]: https://docs.rs/despatma/latest/despatma/macro.visitor.html
[dependency_container]: https://docs.rs/despatma/latest/despatma/macro.dependency_container.html
# Despatma
[![github]](https://github.com/chesedo/despatma) [![crates-io]](https://crates.io/crates/despatma) [![docs-rs]](https://docs.rs/despatma) [![workflow]](https://github.com/chesedo/despatma/actions?query=workflow%3ARust)

[github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
[crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust
[docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logoColor=white&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K
[workflow]: https://img.shields.io/github/actions/workflow/status/chesedo/despatma/rust.yml?color=green&label=&labelColor=555555&logo=github%20actions&logoColor=white&style=for-the-badge

Despatma is a collection of `des`ign `pat`tern `ma`cros (`despatma`) born from a [Honours project](https://github.com/chesedo/cos-700/blob/master/Report%20-%20Final.pdf).
It aims to provide the most common implementations for design patterns at run-time.

This project is still a **work in progress**.
The end goal is to be as [Loki](http://loki-lib.sourceforge.net/) is for C++ and more if possible.
The following patterns are currently implemented:
- [abstract_factory] - with the help of [interpolate_traits] macro
- [visitor]
- [dependency_container]

Next up for investigation is:
- [ ] Decorator
- [ ] Proxy
- [ ] Adapter
- [ ] Mediator
- [ ] Observer
- [ ] A smarter Visitor

[abstract_factory]: https://docs.rs/despatma/latest/despatma/attr.abstract_factory.html
[interpolate_traits]: https://docs.rs/despatma/latest/despatma/attr.interpolate_traits.html
[visitor]: https://docs.rs/despatma/latest/despatma/macro.visitor.html
[dependency_container]: https://docs.rs/despatma/latest/despatma/macro.dependency_container.html
44 changes: 22 additions & 22 deletions despatma-abstract-factory/tests/fail/library/elements.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/// All gui elements
pub trait Element {
fn create() -> Self
where
Self: Sized;
}

/// Non-abstract window element to test not using `dyn`
pub struct Window {
width: usize,
}

impl Element for Window {
fn create() -> Self {
Window { width: 50 }
}
}

/// Abstract type
pub trait Button: Element {
fn click(&self);
}
/// All gui elements
pub trait Element {
fn create() -> Self
where
Self: Sized;
}

/// Non-abstract window element to test not using `dyn`
pub struct Window {
width: usize,
}

impl Element for Window {
fn create() -> Self {
Window { width: 50 }
}
}

/// Abstract type
pub trait Button: Element {
fn click(&self);
}
2 changes: 1 addition & 1 deletion despatma-abstract-factory/tests/fail/library/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub mod elements;
pub mod elements;
2 changes: 1 addition & 1 deletion despatma-visitor/tests/fail/library/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub mod shapes;
pub mod shapes;
72 changes: 36 additions & 36 deletions despatma-visitor/tests/fail/library/shapes.rs
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
pub trait Circle {
fn get_center(&self) -> (usize, usize);
}

pub trait Cube {
fn get_center(&self) -> (usize, usize, usize);
fn get_front(&self) -> &Rectangle;
}

pub trait Sphere {
fn get_center(&self) -> (usize, usize, usize);
}

pub struct Arc {
radius: usize,
}

impl Arc {
pub fn get_radius(&self) -> usize {
self.radius
}
}

pub struct Rectangle {
width: usize,
height: usize,
}

impl Rectangle {
pub fn get_height(&self) -> usize {
self.height
}
pub fn get_width(&self) -> usize {
self.width
}
}
pub trait Circle {
fn get_center(&self) -> (usize, usize);
}

pub trait Cube {
fn get_center(&self) -> (usize, usize, usize);
fn get_front(&self) -> &Rectangle;
}

pub trait Sphere {
fn get_center(&self) -> (usize, usize, usize);
}

pub struct Arc {
radius: usize,
}

impl Arc {
pub fn get_radius(&self) -> usize {
self.radius
}
}

pub struct Rectangle {
width: usize,
height: usize,
}

impl Rectangle {
pub fn get_height(&self) -> usize {
self.height
}
pub fn get_width(&self) -> usize {
self.width
}
}

0 comments on commit 9c3de5f

Please sign in to comment.