Improve mod & struct visibility & hierarchy #10

Open
harry wants to merge 4 commits from fix-visibility into master
Contributor

This PR will change the visibility of mods and structs. The following items will be hidden from external access:

  • spi (except spi::interfaces) - the SPI driver is intended for the ENC424J600 driver only.
  • rx (except rx::RxPacket) - the buffer is to be controlled by the ENC424J600 driver only.
  • tx (except tx::TxPacket) - ditto.

The following selected items will be exposed for access with aliases:

  • spi::interfacesSpiInterfaces - it contains specific settings for SPI as recommended by the datasheet, which are good default settings but not mandatory.
  • rx::RxPacketRxPacket - it is the type returned from the public function Enc424j600::recv_packet(), which is crucial for non-smoltcp applications.
  • tx::TxPacketTxPacket - it describes the packet to send with the public function Enc424j600::send_packet(), also crucial for non-smoltcp applications.
  • smoltcp_phy::SmoltcpDeviceSmoltcpDevice - this struct is the only item within the smoltcp_phy mod, and crucial for smoltcp applications.

Any comments are welcome. Thanks!

This PR will change the visibility of mods and structs. The following items will be hidden from external access: * **`spi`** (except `spi::interfaces`) - the SPI driver is intended for the ENC424J600 driver only. * **`rx`** (except `rx::RxPacket`) - the buffer is to be controlled by the ENC424J600 driver only. * **`tx`** (except `tx::TxPacket`) - ditto. The following selected items will be exposed for access with aliases: * `spi::interfaces` → **`SpiInterfaces`** - it contains specific settings for SPI as recommended by the datasheet, which are good default settings but not mandatory. * `rx::RxPacket` → **`RxPacket`** - it is the type returned from the public function `Enc424j600::recv_packet()`, which is crucial for non-smoltcp applications. * `tx::TxPacket` → **`TxPacket`** - it describes the packet to send with the public function `Enc424j600::send_packet()`, also crucial for non-smoltcp applications. * `smoltcp_phy::SmoltcpDevice` → **`SmoltcpDevice`** - this struct is the only item within the `smoltcp_phy` mod, and crucial for smoltcp applications. Any comments are welcome. Thanks!
harry force-pushed fix-visibility from c8e2024be1 to 39d86ac98c 2021-06-23 15:33:37 +08:00 Compare
harry force-pushed fix-visibility from 39d86ac98c to 41ea7c3b3f 2021-09-02 17:12:47 +08:00 Compare
This pull request has changes conflicting with the target branch.
  • examples/tcp_stm32f407.rs
  • examples/tx_stm32f407.rs
  • src/lib.rs
  • src/rx.rs
  • src/tx.rs

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix-visibility:fix-visibility
git checkout fix-visibility
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: renet/ENC424J600#10
No description provided.