Move stub into local/mod.rs

This commit is contained in:
Paul Dicker 2023-05-26 13:41:54 +02:00 committed by Dirkjan Ochtman
parent 2b7a068be8
commit 51cce84b86
2 changed files with 19 additions and 29 deletions

View File

@ -13,8 +13,14 @@ use crate::naive::{NaiveDate, NaiveDateTime, NaiveTime};
use crate::Date;
use crate::{DateTime, Utc};
// we don't want `stub.rs` when the target_os is not wasi or emscripten
// as we use js-sys to get the date instead
#[cfg(unix)]
#[path = "unix.rs"]
mod inner;
#[cfg(windows)]
#[path = "windows.rs"]
mod inner;
#[cfg(all(
not(unix),
not(windows),
@ -24,16 +30,19 @@ use crate::{DateTime, Utc};
not(any(target_os = "emscripten", target_os = "wasi"))
))
))]
#[path = "stub.rs"]
mod inner;
mod inner {
use crate::{FixedOffset, LocalResult, NaiveDateTime};
#[cfg(unix)]
#[path = "unix.rs"]
mod inner;
pub(super) fn offset_from_utc_datetime(_utc_time: &NaiveDateTime) -> LocalResult<FixedOffset> {
LocalResult::Single(FixedOffset::east_opt(0).unwrap())
}
#[cfg(windows)]
#[path = "windows.rs"]
mod inner;
pub(super) fn offset_from_local_datetime(
_local_time: &NaiveDateTime,
) -> LocalResult<FixedOffset> {
LocalResult::Single(FixedOffset::east_opt(0).unwrap())
}
}
#[cfg(unix)]
mod tz_info;

View File

@ -1,19 +0,0 @@
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::{FixedOffset, LocalResult, NaiveDateTime};
pub(super) fn offset_from_utc_datetime(_utc_time: &NaiveDateTime) -> LocalResult<FixedOffset> {
LocalResult::Single(FixedOffset::east_opt(0).unwrap())
}
pub(super) fn offset_from_local_datetime(_local_time: &NaiveDateTime) -> LocalResult<FixedOffset> {
LocalResult::Single(FixedOffset::east_opt(0).unwrap())
}