Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
matthijsr committed Sep 23, 2021
1 parent 30cb01b commit e0a78aa
Show file tree
Hide file tree
Showing 8 changed files with 880 additions and 883 deletions.
38 changes: 19 additions & 19 deletions src/design/implementation/composer/impl_backend/mod.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use core::fmt::{Debug, Formatter};
use crate::design::StreamletHandle;
use crate::error::Result;
use crate::Name;

///Trait for general implementation backends
pub trait ImplementationBackend {
fn name(&self) -> Name;
fn streamlet_handle(&self) -> StreamletHandle;
fn connect_action(&self) -> Result<()> {
unimplemented!()
}
}

impl Debug for dyn ImplementationBackend {
fn fmt(&self, _f: &mut Formatter<'_>) -> std::fmt::Result {
unimplemented!()
}
}
use crate::design::StreamletHandle;
use crate::error::Result;
use crate::Name;
use core::fmt::{Debug, Formatter};

///Trait for general implementation backends
pub trait ImplementationBackend {
fn name(&self) -> Name;
fn streamlet_handle(&self) -> StreamletHandle;
fn connect_action(&self) -> Result<()> {
unimplemented!()
}
}

impl Debug for dyn ImplementationBackend {
fn fmt(&self, _f: &mut Formatter<'_>) -> std::fmt::Result {
unimplemented!()
}
}
6 changes: 3 additions & 3 deletions src/design/implementation/composer/patterns.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::borrow::Borrow;
use std::convert::TryFrom;

use crate::design::implementation::composer::impl_backend::ImplementationBackend;
use crate::design::implementation::composer::GenericComponent;
use crate::design::implementation::Implementation;
use crate::design::{IFKey, Interface, Mode, Project, Streamlet, StreamletHandle, StreamletKey};
use crate::logical::{Direction, LogicalType, Stream, Synchronicity};
use crate::physical::Complexity;
use crate::{Error, Name, NonZeroReal, Result, UniqueKeyBuilder};
use crate::design::implementation::composer::impl_backend::ImplementationBackend;

///! MapStream construct
#[derive(Clone, Debug)]
Expand Down Expand Up @@ -348,10 +348,10 @@ impl ImplementationBackend for FilterStreamBackend {
mod tests {
use std::convert::TryFrom;

use crate::design::StreamletHandle;
use crate::{Name, Result};
use super::*;
use crate::design::implementation::composer::tests::composition_test_proj;
use crate::design::StreamletHandle;
use crate::{Name, Result};

#[test]
fn test_map() -> Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion src/stdlib/basic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
//! see use in most streaming hardware, or can be used to build
//! more complex components.

pub mod stub;
pub mod stub;
82 changes: 40 additions & 42 deletions src/stdlib/common/architecture/assignment/array_assignment.rs
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
use indexmap::IndexMap;

use crate::{
stdlib::common::architecture::assignment::{AssignmentKind, RangeConstraint},
};

/// An enum for describing complete assignment to an array
#[derive(Debug, Clone)]
pub enum ArrayAssignment {
/// Assigning all of an array directly (may concatenate objects)
Direct(Vec<AssignmentKind>),
/// Assign some fields directly, and may assign all other fields a single value (e.g. ( 1 => '1', others => '0' ), or ( 1 downto 0 => '1', others => '0' ))
Sliced {
direct: IndexMap<RangeConstraint, AssignmentKind>,
others: Option<Box<AssignmentKind>>,
},
/// Assigning a single value to all of an array
Others(Box<AssignmentKind>),
}

impl ArrayAssignment {
pub fn direct(values: Vec<AssignmentKind>) -> ArrayAssignment {
ArrayAssignment::Direct(values)
}

pub fn partial(
direct: IndexMap<RangeConstraint, AssignmentKind>,
others: Option<AssignmentKind>,
) -> ArrayAssignment {
ArrayAssignment::Sliced {
direct,
others: match others {
Some(value) => Some(Box::new(value)),
None => None,
},
}
}

pub fn others(value: AssignmentKind) -> ArrayAssignment {
ArrayAssignment::Others(Box::new(value))
}
}
use indexmap::IndexMap;

use crate::stdlib::common::architecture::assignment::{AssignmentKind, RangeConstraint};

/// An enum for describing complete assignment to an array
#[derive(Debug, Clone)]
pub enum ArrayAssignment {
/// Assigning all of an array directly (may concatenate objects)
Direct(Vec<AssignmentKind>),
/// Assign some fields directly, and may assign all other fields a single value (e.g. ( 1 => '1', others => '0' ), or ( 1 downto 0 => '1', others => '0' ))
Sliced {
direct: IndexMap<RangeConstraint, AssignmentKind>,
others: Option<Box<AssignmentKind>>,
},
/// Assigning a single value to all of an array
Others(Box<AssignmentKind>),
}

impl ArrayAssignment {
pub fn direct(values: Vec<AssignmentKind>) -> ArrayAssignment {
ArrayAssignment::Direct(values)
}

pub fn partial(
direct: IndexMap<RangeConstraint, AssignmentKind>,
others: Option<AssignmentKind>,
) -> ArrayAssignment {
ArrayAssignment::Sliced {
direct,
others: match others {
Some(value) => Some(Box::new(value)),
None => None,
},
}
}

pub fn others(value: AssignmentKind) -> ArrayAssignment {
ArrayAssignment::Others(Box::new(value))
}
}
2 changes: 1 addition & 1 deletion src/stdlib/common/architecture/assignment/assign.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::convert::{TryInto};
use std::convert::TryInto;

use super::{Assign, AssignDeclaration, Assignment};
use crate::{stdlib::common::architecture::declaration::ObjectDeclaration, Error, Result};
Expand Down
Loading

0 comments on commit e0a78aa

Please sign in to comment.