Skip to content

Commit

Permalink
feat(#45): <O>
Browse files Browse the repository at this point in the history
  • Loading branch information
h1alexbel committed Oct 10, 2024
1 parent fa13f37 commit 5a5f99f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions server/src/init/server_with_init_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,30 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
use crate::{DtServer, Server};
use crate::Server;
use anyhow::Result;

/// Bootstrap server.
pub struct ServerWithInitState {
pub struct ServerWithInitState<O> {
/// Origin.
pub origin: DtServer,
pub origin: O,
/// Path to file or directory with state.
pub path: String,
}

impl ServerWithInitState {
pub fn new(origin: DtServer, path: String) -> ServerWithInitState {
impl<O> ServerWithInitState<O>
where
O: Server,
{
pub fn new(origin: O, path: String) -> ServerWithInitState<O> {
ServerWithInitState { origin, path }
}
}

impl Server for ServerWithInitState {
impl<O> Server for ServerWithInitState<O>
where
O: Server,
{
/// Start.
async fn start(self) -> Result<()> {
self.origin.start().await
Expand Down

0 comments on commit 5a5f99f

Please sign in to comment.